Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bookmark: Release v2.10.4

Daniel147d08377047
diff --git a/kernel/util/file.go b/kernel/util/file.go
index 1fc17237cc..e8ec1aed00 100644
--- a/kernel/util/file.go
+++ b/kernel/util/file.go
@@ -136,15 +136,19 @@ func TruncateLenFileName(name string) (ret string) {
// 插入资源文件时文件名长度最大限制 189 字节 https://github.com/siyuan-note/siyuan/issues/7099
ext := filepath.Ext(name)
var byteCount int
+ truncated := false
buf := bytes.Buffer{}
for _, r := range name {
byteCount += utf8.RuneLen(r)
if 189-len(ext) < byteCount {
+ truncated = true
break
}
buf.WriteRune(r)
}
- buf.WriteString(ext)
+ if truncated {
+ buf.WriteString(ext)
+ }
ret = buf.String()
return
}