Skip to content

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

:art: 文档未索引的情况下文档树打开文档返回报错消息

Liang Dinge3e50e9cff3e
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index 833800b4cf..ff3a71052b 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -44,9 +44,6 @@ export const openFileById = (options: {
lockFile(data.data);
return;
}
- if (data.code === 1) {
- showMessage(data.msg);
- }
openFile({
fileName: data.data.rootTitle,
rootIcon: data.data.rootIcon,
diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts
index 0032e67523..5d1562ed6c 100644
--- a/app/src/mobile/editor.ts
+++ b/app/src/mobile/editor.ts
@@ -49,10 +49,6 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
lockFile(data.data);
return;
}
- if (data.code === 1) {
- showMessage(data.msg);
- return;
- }
if (window.siyuan.mobileEditor) {
addLoading(window.siyuan.mobileEditor.protyle);
fetchPost("/api/filetree/getDoc", {
diff --git a/kernel/api/block.go b/kernel/api/block.go
index a82b15c747..421b3c3a80 100644
--- a/kernel/api/block.go
+++ b/kernel/api/block.go
@@ -93,6 +93,11 @@ func getDocInfo(c *gin.Context) {
id := arg["id"].(string)
info := model.GetDocInfo(id)
+ if nil == info {
+ ret.Code = -1
+ ret.Msg = fmt.Sprintf(model.Conf.Language(15), id)
+ return
+ }
ret.Data = info
}
@@ -266,7 +271,7 @@ func getBlockInfo(c *gin.Context) {
return
}
if nil == block {
- ret.Code = 1
+ ret.Code = -1
ret.Msg = fmt.Sprintf(model.Conf.Language(15), id)
return
}
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index 7e3643e8bc..e2e75a0877 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -48,7 +48,7 @@ func GetDocInfo(rootID string) (ret *BlockInfo) {
tree, err := loadTreeByBlockID(rootID)
if nil != err {
- util.LogErrorf("load tree by block id failed: %s", err)
+ util.LogErrorf("load tree by root id [%s] failed: %s", rootID, err)
return
}