Skip to content

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

:perf: Skip empty tag writes after creating Markdown documents https://github.com/siyuan-note/siyuan/issues/20371

Daniela5bf76ba19cf
diff --git a/kernel/model/file.go b/kernel/model/file.go
index e76487f55f..25833a2c08 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1372,7 +1372,6 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
}
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id, titleEmpty)
- nameValues := map[string]string{}
tags = strings.TrimSpace(tags)
tags = strings.ReplaceAll(tags, ",", ",")
tagArray := strings.Split(tags, ",")
@@ -1381,8 +1380,9 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
tmp = append(tmp, strings.TrimSpace(tag))
}
tags = strings.Join(tmp, ",")
- nameValues["tags"] = tags
- SetBlockAttrs(retID, nameValues)
+ if tags != "" {
+ SetBlockAttrs(retID, map[string]string{"tags": tags})
+ }
FlushTxQueue()