浏览代码

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 7 月之前
父节点
当前提交
ca5d906612
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      kernel/model/box.go

+ 5 - 2
kernel/model/box.go

@@ -596,7 +596,7 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
 					}
 					continue
 				}
-				if "tags" == attrK {
+				if "tags" == attrK && nil != attrV {
 					var tags string
 					if str, ok := attrV.(string); ok {
 						tags = strings.TrimSpace(str)
@@ -614,7 +614,10 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
 						tags += tagStr + ","
 					}
 					tags = strings.TrimRight(tags, ",")
-					tree.Root.SetIALAttr("tags", tags)
+					tags = strings.TrimSpace(tags)
+					if "" != tags {
+						tree.Root.SetIALAttr("tags", tags)
+					}
 					continue
 				}