From e3e50e9cff3e45091c86db8b9231d9768b8c6c97 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sat, 9 Jul 2022 17:37:54 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=87=E6=A1=A3=E6=9C=AA=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=A0=91=E6=89=93=E5=BC=80=E6=96=87=E6=A1=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/editor/util.ts | 3 --- app/src/mobile/editor.ts | 4 ---- kernel/api/block.go | 7 ++++++- kernel/model/blockinfo.go | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) 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 }