diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 833800b4c..ff3a71052 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 0032e6752..5d1562ed6 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 a82b15c74..421b3c3a8 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 7e3643e8b..e2e75a087 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 }