fix(storage): apply driver switch on save and repoint upload records

Saving storage settings now activates the selected driver immediately
instead of staging it until migration. When the driver changes, existing
upload rows are repointed to the new storage_driver so /f/{id} reads use
the correct backend. ForDriver can also open non-active drivers from the
saved multi-backend config.
This commit is contained in:
ryan
2026-06-18 13:39:07 +08:00
parent 6fa7034172
commit 1f391e9ec2
9 changed files with 134 additions and 47 deletions
@@ -310,10 +310,6 @@ func validateAndMergeStorageConfig(ctx context.Context, value string, currentCon
if err := validateMergedStorageConfig(ctx, currentCfg, newCfg, targetCfg); err != nil {
return "", err
}
if newCfg.Driver != "" && newCfg.Driver != currentCfg.Driver {
// 切换存储类型时仅暂存目标后端参数,活动 driver 由迁移任务正式切换。
targetCfg.Driver = currentCfg.Driver
}
// 序列化为最终保存的真实明文配置,防止保存屏蔽的 ****** 字符
unmaskedVal, err := json.Marshal(targetCfg)