fix: 脚本用自己内容的hash生成路径,避免与config文件冲突导致file exists

This commit is contained in:
mediabot-pt
2026-07-01 12:57:57 +08:00
parent 4aab1a74a5
commit 8c95af8028
2 changed files with 10 additions and 10 deletions

View File

@@ -83,10 +83,11 @@ public class ConfigServiceImpl implements ConfigService {
}
}
// 存储 Groovy 脚本
// 存储 Groovy 脚本(用脚本自己的 hash,不和 config 共用)
String scriptPath = null;
if (hasScript) {
scriptPath = String.format("configs/%s/pending/%s.groovy", siteId, idPrefix);
String scriptHash = HmacUtil.sha256(groovyScript);
scriptPath = String.format("configs/%s/pending/%s.groovy", siteId, scriptHash.substring(0, 8));
storageService.store(scriptPath, groovyScript);
}