From 3d1e6d5fed08691752cd09e7f68c808a74fd2229 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 5 Aug 2022 13:29:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:art:=20API=20`setBlockAttrs`=20=E4=B8=AD?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=AD=98=E5=9C=A8=E5=B1=9E=E6=80=A7=E5=80=BC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=20`null`=20=E6=97=B6=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E8=AF=A5=E5=B1=9E=E6=80=A7=20Fix=20https://github.com?= =?UTF-8?q?/siyuan-note/siyuan/issues/5577?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/attr.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/api/attr.go b/kernel/api/attr.go index af996f660..0c1d2dbcc 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 { From 0ecac469085a1f828855a4b6be12ecb8092abfc1 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 5 Aug 2022 16:04:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:bug:=20=E6=8F=92=E5=85=A5/=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E5=B4=A9=E6=BA=83=20https://github.com/siyua?= =?UTF-8?q?n-note/siyuan/issues/5574?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets_watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/assets_watcher.go b/kernel/model/assets_watcher.go index ef2ebad03..b12e08da8 100644 --- a/kernel/model/assets_watcher.go +++ b/kernel/model/assets_watcher.go @@ -53,7 +53,7 @@ func watchAssets() { } go func() { - logging.Recover() + defer logging.Recover() var ( timer *time.Timer