From 02b0c553e3cd5193e211bc786c1456987c858276 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 14 Jun 2022 15:06:41 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=B8=85=E7=90=86=E6=9C=AA=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E8=B5=84=E6=BA=90=E6=97=B6=E6=9C=AA=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=20`custom-data-assets`=20=E5=B1=9E=E6=80=A7=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/4122?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets.go | 6 +++++- kernel/sql/database.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 4d20a0eda..15479fcda 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -550,7 +550,11 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) { ret = append(ret, dest) } else { if ast.NodeWidget == n.Type { - dataAssets := n.IALAttr("data-assets") + dataAssets := n.IALAttr("custom-data-assets") + if "" == dataAssets { + // 兼容两种属性名 custom-data-assets 和 data-assets https://github.com/siyuan-note/siyuan/issues/4122#issuecomment-1154796568 + dataAssets = n.IALAttr("data-assets") + } if "" == dataAssets || !isRelativePath([]byte(dataAssets)) { return ast.WalkContinue } diff --git a/kernel/sql/database.go b/kernel/sql/database.go index b241b4294..a7b541847 100644 --- a/kernel/sql/database.go +++ b/kernel/sql/database.go @@ -578,7 +578,7 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) ( var src []byte for _, attr := range nodes[0].Attr { - if "src" == attr.Key || "data-assets" == attr.Key { + if "src" == attr.Key || "data-assets" == attr.Key || "custom-data-assets" == attr.Key { src = gulu.Str.ToBytes(attr.Val) break }