fix: 脚本编辑路径始终用 pending/,避免与七牛云 approved/ 冲突

This commit is contained in:
mediabot-pt
2026-07-01 11:33:44 +08:00
parent 066e3f5899
commit 7e66d3c830

View File

@@ -265,9 +265,13 @@ public class AdminController {
if (scriptPath == null || scriptPath.isBlank()) {
String hash = config.getConfigHash() != null ? config.getConfigHash().substring(0, 8)
: Long.toHexString(System.currentTimeMillis());
// 始终用 pending 目录,审批通过时才移到 approved
scriptPath = String.format("configs/%s/pending/%s.groovy", config.getSiteId(), hash);
config.setScriptStoragePath(scriptPath);
} else {
// 已有路径也强制用 pending 目录
scriptPath = scriptPath.replace("/approved/", "/pending/");
}
config.setScriptStoragePath(scriptPath);
// 只保存到本地,审批通过时才同步到七牛云
localStorageService.store(scriptPath, script);
siteConfigMapper.updateById(config);