From f9bc907edf91c1815814b50909fb00e8ea98c617 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 15 Aug 2022 16:49:49 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=9F=A5=E8=AF=A2=E6=9C=AA=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20Fix=20https://github.com/siyuan-note/siyuan/issues/5642?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 734c6b833..b216aad6f 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -694,13 +694,17 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) { } else { // HTMLBlock/InlineHTML/IFrame/Audio/Video if index := bytes.Index(n.Tokens, []byte("src=\"")); 0 < index { src := n.Tokens[index+len("src=\""):] - src = src[:bytes.Index(src, []byte("\""))] - if !isRelativePath(src) { - return ast.WalkContinue - } + if index = bytes.Index(src, []byte("\"")); 0 < index { + src = src[:bytes.Index(src, []byte("\""))] + if !isRelativePath(src) { + return ast.WalkContinue + } - dest := strings.TrimSpace(string(src)) - ret = append(ret, dest) + dest := strings.TrimSpace(string(src)) + ret = append(ret, dest) + } else { + logging.LogWarnf("src is missing the closing double quote in tree [%s] ", tree.Box+tree.Path) + } } } }