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: Scope block breadcrumb requests to notebooks https://github.com/siyuan-note/siyuan/issues/19171
Danield81084433950
diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex dd0bdeb490..bd2a67efe2 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -621,7 +621,7 @@ export class Outline extends Model {excludeTypes: []};const notebookId = this.getNotebookId();- if (isEncryptedBox(notebookId)) {+ if (notebookId) {breadcrumbParam.notebook = notebookId;}fetchPost("/api/block/getBlockBreadcrumb", breadcrumbParam, (response) => {diff --git a/app/src/mobile/dock/MobileOutline.ts b/app/src/mobile/dock/MobileOutline.tsindex c89d6a5b80..6b47a09cb6 100644--- a/app/src/mobile/dock/MobileOutline.ts+++ b/app/src/mobile/dock/MobileOutline.ts@@ -467,7 +467,7 @@ export class MobileOutline extends Model {excludeTypes: []};const mobileProtyle = window.siyuan.mobile.editor?.protyle;- if (mobileProtyle && mobileProtyle.block.rootID === this.blockId && isEncryptedBox(mobileProtyle.notebookId)) {+ if (mobileProtyle && mobileProtyle.block.rootID === this.blockId) {breadcrumbParam.notebook = mobileProtyle.notebookId;}fetchPost("/api/block/getBlockBreadcrumb", breadcrumbParam, (response) => {diff --git a/kernel/api/block.go b/kernel/api/block.goindex ed038af179..f46f38d6ec 100644--- a/kernel/api/block.go+++ b/kernel/api/block.go@@ -1038,7 +1038,7 @@ func getBlockBreadcrumb(c *gin.Context) {}}- boxID := encryptedNotebookFromArg(arg)+ boxID, _ := arg["notebook"].(string)if !holdBlockRequest(c, ret, boxID, arg) {return}diff --git a/kernel/api/block_test.go b/kernel/api/block_test.goindex 09936d0544..855d413057 100644--- a/kernel/api/block_test.go+++ b/kernel/api/block_test.go@@ -369,6 +369,14 @@ func TestBlockPublishAccessGuards(t *testing.T) {if response["code"].(float64) != 0 || response["data"].(float64) != 0 {t.Fatalf("missing block should report a zero index without an API error: %v", response)}+ response = blockGuardRequest(model.RoleAdministrator, `{"id":"`+missingID+`"}`, getBlockBreadcrumb)+ if response["code"].(float64) == 0 {+ t.Fatalf("missing block without a notebook should be rejected: %v", response)+ }+ response = blockGuardRequest(model.RoleAdministrator, `{"id":"`+missingID+`","notebook":"`+boxID+`"}`, getBlockBreadcrumb)+ if response["code"].(float64) != 0 || len(response["data"].([]any)) != 0 {+ t.Fatalf("missing block in an explicit notebook should report an empty breadcrumb without an API error: %v", response)+ }})}