An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Keep published resource candidates in their notebook scope https://github.com/siyuan-note/siyuan/issues/20258
Danieleb09e5bdcff5
diff --git a/kernel/model/publish_resource_access.go b/kernel/model/publish_resource_access.goindex 08dd370b89..68842e5b9b 100644--- a/kernel/model/publish_resource_access.go+++ b/kernel/model/publish_resource_access.go@@ -106,7 +106,7 @@ func checkResourceAccessableByPublishAccess(c *gin.Context, resource string, pubreturn true}boxID, rootID, _ := strings.Cut(key.(string), "/")- bt := treenode.GetBlockTreeInBox(rootID, boxID)+ bt := treenode.GetBlockTreeInExactBox(rootID, boxID)if bt != nil && bt.Type == "d" && bt.Updated == refs.updated &&getBlockTreePublishAccessStatus(c, publishAccess, publishDisable, bt) == PublishAccessAllowed {found = truediff --git a/kernel/model/publish_resource_access_test.go b/kernel/model/publish_resource_access_test.goindex 760ee067c6..6fcd0c4988 100644--- a/kernel/model/publish_resource_access_test.go+++ b/kernel/model/publish_resource_access_test.go@@ -98,10 +98,21 @@ func TestCachedPublishResourceRechecksDocumentAndAuthorization(t *testing.T) {if CheckEmojiAccessableByPublishAccess(c, "icon.png", nil) {t.Fatal("changed document authorized a stale reference")}+ publishResourceRefsCache.Store(cacheKey, &publishResourceRefs{+ updated: root.IALAttr("updated"), emojis: map[string]struct{}{"icon.png": {}},+ })+ if !CheckEmojiAccessableByPublishAccess(c, "icon.png", nil) {+ t.Fatal("current document reference could not authorize the resource")+ }treenode.RemoveBlockTreesByRootID(boxID, rootID)if CheckEmojiAccessableByPublishAccess(c, "icon.png", nil) {t.Fatal("deleted document authorized a cached resource")}+ tree.Box = "20261008000000-other01"+ treenode.IndexBlockTree(tree)+ if CheckEmojiAccessableByPublishAccess(c, "icon.png", nil) {+ t.Fatal("another notebook reused the cached document reference")+ }}func TestPublishResourceURLPath(t *testing.T) {