fix(media): 资源分发 - 统一 CDN 读取签名与源站降级边界

This commit is contained in:
ddCat
2026-09-22 23:26:28 +08:00
parent 62dd62a96c
commit 6c013ebf7e
6 changed files with 114 additions and 15 deletions

View File

@@ -35,6 +35,7 @@ func newResourceFallbackTestService(t *testing.T) (*Service, *gorm.DB) {
// 配置了 OSS(enabled=1、endpoint 不可达)时上传应回退本地存储成功,
// 而不是把上传标记为失败——本地媒体导入不应因外部存储故障整体失败。
func TestStoreResourceDegradesToLocalWhenOSSUnavailable(t *testing.T) {
t.Setenv("CANVAS_ALLOWED_PRIVATE_UPSTREAM_HOSTS", "127.0.0.1")
service, db := newResourceFallbackTestService(t)
seedOSSEnabled(t, db, "user-1", "http://127.0.0.1:1")