Browse Source

:bug: 存在命名的块复制为引用时未转义命名文本 Fix https://github.com/siyuan-note/siyuan/issues/7254

Liang Ding 2 years ago
parent
commit
ea45e7ccb3
1 changed files with 4 additions and 2 deletions
  1. 4 2
      kernel/model/blockinfo.go

+ 4 - 2
kernel/model/blockinfo.go

@@ -94,8 +94,10 @@ func GetBlockRefText(id string) string {
 }
 }
 
 
 func getNodeRefText(node *ast.Node) string {
 func getNodeRefText(node *ast.Node) string {
-	if name := node.IALAttr("name"); "" != name {
-		return name
+	if ret := node.IALAttr("name"); "" != ret {
+		ret = strings.TrimSpace(ret)
+		ret = util.EscapeHTML(ret)
+		return ret
 	}
 	}
 
 
 	switch node.Type {
 	switch node.Type {