Skip to content

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

:art: API `setBlockAttrs` 中如果存在属性值设置为 `null` 时移除该属性 Fix https://github.com/siyuan-note/siyuan/issues/5577

Liang Ding3d1e6d5fed08
diff --git a/kernel/api/attr.go b/kernel/api/attr.go
index af996f6603..0c1d2dbcc3 100644
--- a/kernel/api/attr.go
+++ b/kernel/api/attr.go
@@ -58,7 +58,11 @@ func setBlockAttrs(c *gin.Context) {
attrs := arg["attrs"].(map[string]interface{})
nameValues := map[string]string{}
for name, value := range attrs {
- nameValues[name] = value.(string)
+ if nil == value { // API `setBlockAttrs` 中如果存在属性值设置为 `null` 时移除该属性 https://github.com/siyuan-note/siyuan/issues/5577
+ nameValues[name] = ""
+ } else {
+ nameValues[name] = value.(string)
+ }
}
err := model.SetBlockAttrs(id, nameValues)
if nil != err {