Skip to content

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

:bug: 资源文件变成了未引用资源 Fix https://github.com/siyuan-note/insider/issues/1048

Liang Ding371062efdbbd
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index 23aa82e12a..622804dceb 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -685,7 +685,8 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) {
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
// 修改以下代码时需要同时修改 database 构造行级元素实现,增加必要的类型
if !entering || (ast.NodeLinkDest != n.Type && ast.NodeHTMLBlock != n.Type && ast.NodeInlineHTML != n.Type &&
- ast.NodeIFrame != n.Type && ast.NodeWidget != n.Type && ast.NodeAudio != n.Type && ast.NodeVideo != n.Type) {
+ ast.NodeIFrame != n.Type && ast.NodeWidget != n.Type && ast.NodeAudio != n.Type && ast.NodeVideo != n.Type &&
+ !n.IsTextMarkType("a")) {
return ast.WalkContinue
}
@@ -696,6 +697,13 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) {
dest := strings.TrimSpace(string(n.Tokens))
ret = append(ret, dest)
+ } else if n.IsTextMarkType("a") {
+ if !isRelativePath(gulu.Str.ToBytes(n.TextMarkAHref)) {
+ return ast.WalkContinue
+ }
+
+ dest := strings.TrimSpace(n.TextMarkAHref)
+ ret = append(ret, dest)
} else {
if ast.NodeWidget == n.Type {
dataAssets := n.IALAttr("custom-data-assets")