An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Fix https://github.com/siyuan-note/siyuan/issues/16576
Danielea925aff32b4
diff --git a/kernel/model/upload.go b/kernel/model/upload.goindex 49a896a167..76f9e9ec74 100644--- a/kernel/model/upload.go+++ b/kernel/model/upload.go@@ -84,14 +84,26 @@ func InsertLocalAssets(id string, assetAbsPaths []string, isUpload bool) (succMaerr = openErrreturn}+hash, hashErr := util.GetEtagByHandle(f, fi.Size())if nil != hashErr {f.Close()return}- if existAssetPath := GetAssetPathByHash(hash); "" != existAssetPath {- // 已经存在同样数据的资源文件的话不重复保存+ if 1 > fi.Size() {+ hash = "random_1_" + gulu.Rand.String(12)+ }++ existAssetPath := GetAssetPathByHash(hash)+ if "" != existAssetPath {+ originalName := util.RemoveID(filepath.Base(existAssetPath))+ if fName != originalName {+ hash = "random_2_" + gulu.Rand.String(12)+ }+ }++ if "" != existAssetPath && !strings.HasPrefix(hash, "random_") {succMap[baseName] = existAssetPath} else {fName = util.AssetName(fName, ast.NewNodeID())@@ -200,8 +212,19 @@ func Upload(c *gin.Context) {break}- if existAssetPath := GetAssetPathByHash(hash); "" != existAssetPath {- // 已经存在同样数据的资源文件的话不重复保存+ if 1 > file.Size {+ hash = "empty_" + gulu.Rand.String(12)+ }++ existAssetPath := GetAssetPathByHash(hash)+ if "" != existAssetPath {+ originalName := util.RemoveID(filepath.Base(existAssetPath))+ if fName != originalName {+ hash = "random_2_" + gulu.Rand.String(12)+ }+ }++ if "" != existAssetPath && !strings.HasPrefix(hash, "random_") {succMap[baseName] = existAssetPath} else {if skipIfDuplicated {