refactor(*): 稳定期治理 - 收敛核心架构、错误语义并修复跨项目数据竞态

This commit is contained in:
ddCat committed 2026-09-09 22:02:10 +08:00
1 parent bacd502f5c
commit b5f3413ded
298 files changed
+12681 -26428

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package service
import "strings"
func resourceFileURL(id string) string {
return "/api/resources/" + id + "/file"
}
func isResourceFileURL(value string) bool {
return resourceIDFromFileURL(value) != ""
}
func resourceIDFromFileURL(value string) string {
const prefix = "/api/resources/"
value = strings.TrimSpace(value)
index := strings.Index(value, prefix)
if index < 0 {
return ""
}
remainder := value[index+len(prefix):]
if remainder == "" {
return ""
}
if end := strings.IndexAny(remainder, "/?#"); end >= 0 {
remainder = remainder[:end]
}
return remainder
}