Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17549

Daniel325dd69a10bf
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index c46720edb1..c0d5088efa 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -1357,7 +1357,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
<span class="b3-list-item__icon b3-tooltips b3-tooltips__n popover__block${editingPublishAccess ? " fn__none" : ""}" data-id="${item.id}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
<span class="b3-list-item__switch b3-tooltips b3-tooltips__n${editingPublishAccess ? "" : " fn__none"}" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>
<span class="b3-list-item__text ariaLabel" data-position="parentE"
-aria-label="${ariaLabel}">${getDisplayName(item.name, true, true)}</span>
+aria-label="${ariaLabel}">${getDisplayName(Lute.EscapeHTMLStr(item.name), true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">
<svg><use xlink:href="#iconMore"></use></svg>
</span>
diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.ts
index 62f1bada86..807a7aaa80 100644
--- a/app/src/mobile/dock/MobileFiles.ts
+++ b/app/src/mobile/dock/MobileFiles.ts
@@ -802,7 +802,7 @@ class="b3-list-item" data-path="${item.path}">
</span>
<span class="b3-list-item__icon"${editingPublishAccess ? " fn__none" : ""}>${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
<span class="b3-list-item__switch${editingPublishAccess ? "" : " fn__none"}">${getPublishAccessOptionByLevel("public").iconHTML}</span>
- <span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span>
+ <span class="b3-list-item__text">${getDisplayName(Lute.EscapeHTMLStr(item.name), true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">
<svg><use xlink:href="#iconMore"></use></svg>
</span>
diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts
index 0c4ba697a4..8a33c54827 100644
--- a/app/src/util/pathName.ts
+++ b/app/src/util/pathName.ts
@@ -648,7 +648,7 @@ const getLeaf = (liElement: HTMLElement, flashcard: boolean) => {
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder), "b3-list-item__graphic", true)}
- <span class="b3-list-item__text ariaLabel" data-position="parentE" aria-label="${getDisplayName(item.name, true, true)} <small class='ft__on-surface'>${item.hSize}</small>${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}</span>
+ <span class="b3-list-item__text ariaLabel" data-position="parentE" aria-label="${getDisplayName(Lute.EscapeHTMLStr(item.name), true, true)} <small class='ft__on-surface'>${item.hSize}</small>${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}</span>
${countHTML}
</li>`;
});
diff --git a/kernel/cache/ial.go b/kernel/cache/ial.go
index 6dd8ee5f08..e3403dee56 100644
--- a/kernel/cache/ial.go
+++ b/kernel/cache/ial.go
@@ -17,9 +17,8 @@
package cache
import (
- "strings"
+ "maps"
- "github.com/88250/lute/editor"
"github.com/dgraph-io/ristretto"
)
@@ -40,9 +39,7 @@ func GetDocIAL(p string) (ret map[string]string) {
}
ret = map[string]string{}
- for k, v := range ial.(map[string]string) {
- ret[k] = strings.ReplaceAll(v, editor.IALValEscNewLine, "\n")
- }
+ maps.Copy(ret, ial.(map[string]string))
return
}
diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.go
index 4c93f203fe..680a1667ce 100644
--- a/kernel/filesys/tree.go
+++ b/kernel/filesys/tree.go
@@ -199,7 +199,7 @@ func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *p
if "" == title {
title = "Untitled"
}
- hPathBuilder.WriteString(util.UnescapeHTML(title))
+ hPathBuilder.WriteString(title)
hPathBuilder.WriteString("/")
}
hPathBuilder.WriteString(ret.Root.IALAttr("title"))
@@ -228,6 +228,10 @@ func DocIAL(absPath string) (ret map[string]string) {
}
file.Close()
filelock.Unlock(absPath)
+
+ for k, v := range ret {
+ ret[k] = html.UnescapeAttrVal(v)
+ }
return
}
@@ -386,7 +390,7 @@ func removeUnescapedUnicodeNull(data []byte) []byte {
}
func afterWriteTree(tree *parse.Tree) {
- docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL)
+ docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
cache.PutDocIAL(tree.Path, docIAL)
}
diff --git a/kernel/model/index.go b/kernel/model/index.go
index 1384d3633f..e8af7ac429 100644
--- a/kernel/model/index.go
+++ b/kernel/model/index.go
@@ -170,7 +170,7 @@ func indexBox(boxID string) {
return
}
- docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL)
+ docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
if "" == docIAL["updated"] { // 早期的数据可能没有 updated 属性,这里进行订正
updated := util.TimeFromID(tree.Root.ID)
tree.Root.SetIALAttr("updated", updated)