🐛 查询未引用资源文件异常 Fix https://github.com/siyuan-note/siyuan/issues/5642

This commit is contained in:
Liang Ding 2022-08-15 16:49:49 +08:00
parent 970c1f2e2b
commit f9bc907edf
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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)
}
}
}
}