This commit is contained in:
Daniel 2025-06-25 13:15:55 +08:00
parent 9718d3b1c8
commit 0a17b83372
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 11 additions and 38 deletions

View file

@ -250,21 +250,6 @@ func setNodeAttrs0(node *ast.Node, nameValues map[string]string) (oldAttrs map[s
func pushBroadcastAttrTransactions(oldAttrs map[string]string, node *ast.Node) {
newAttrs := parse.IAL2Map(node.KramdownIAL)
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
for name, value := range oldAttrs {
if "icon" == name {
value = util.FilterUploadEmojiFileName(value)
oldAttrs[name] = value
}
}
for name, value := range newAttrs {
if "icon" == name {
value = util.FilterUploadEmojiFileName(value)
newAttrs[name] = value
}
}
data := map[string]interface{}{"old": oldAttrs, "new": newAttrs}
if "" != node.AttributeViewType {
data["data-av-type"] = node.AttributeViewType

View file

@ -65,13 +65,6 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
title := tree.Root.IALAttr("title")
ret = &BlockInfo{ID: blockID, RootID: tree.Root.ID, Name: title}
ret.IAL = parse.IAL2Map(tree.Root.KramdownIAL)
icon := ret.IAL["icon"]
if strings.Contains(icon, ".") {
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
icon = util.FilterUploadEmojiFileName(icon)
ret.IAL["icon"] = icon
}
scrollData := ret.IAL["scroll"]
if 0 < len(scrollData) {
scroll := map[string]interface{}{}
@ -138,12 +131,7 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
}
}
ret.SubFileCount = subFileCount
icon = tree.Root.IALAttr("icon")
if strings.Contains(icon, ".") {
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
icon = util.FilterUploadEmojiFileName(icon)
}
ret.Icon = icon
ret.Icon = tree.Root.IALAttr("icon")
return
}

View file

@ -80,12 +80,7 @@ func (box *Box) docFromFileInfo(fileInfo *FileInfo, ial map[string]string) (ret
ret.Path = fileInfo.path
ret.Size = uint64(fileInfo.size)
ret.Name = ial["title"] + ".sy"
icon := ial["icon"]
if strings.Contains(icon, ".") {
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
icon = util.FilterUploadEmojiFileName(icon)
}
ret.Icon = icon
ret.Icon = ial["icon"]
ret.ID = ial["id"]
ret.Name1 = ial["name"]
ret.Alias = ial["alias"]