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

This commit is contained in:
Liang Ding 2022-07-09 17:37:54 +08:00
parent b077aaef9f
commit e3e50e9cff
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
4 changed files with 7 additions and 9 deletions

View File

@ -44,9 +44,6 @@ export const openFileById = (options: {
lockFile(data.data); lockFile(data.data);
return; return;
} }
if (data.code === 1) {
showMessage(data.msg);
}
openFile({ openFile({
fileName: data.data.rootTitle, fileName: data.data.rootTitle,
rootIcon: data.data.rootIcon, rootIcon: data.data.rootIcon,

View File

@ -49,10 +49,6 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
lockFile(data.data); lockFile(data.data);
return; return;
} }
if (data.code === 1) {
showMessage(data.msg);
return;
}
if (window.siyuan.mobileEditor) { if (window.siyuan.mobileEditor) {
addLoading(window.siyuan.mobileEditor.protyle); addLoading(window.siyuan.mobileEditor.protyle);
fetchPost("/api/filetree/getDoc", { fetchPost("/api/filetree/getDoc", {

View File

@ -93,6 +93,11 @@ func getDocInfo(c *gin.Context) {
id := arg["id"].(string) id := arg["id"].(string)
info := model.GetDocInfo(id) info := model.GetDocInfo(id)
if nil == info {
ret.Code = -1
ret.Msg = fmt.Sprintf(model.Conf.Language(15), id)
return
}
ret.Data = info ret.Data = info
} }
@ -266,7 +271,7 @@ func getBlockInfo(c *gin.Context) {
return return
} }
if nil == block { if nil == block {
ret.Code = 1 ret.Code = -1
ret.Msg = fmt.Sprintf(model.Conf.Language(15), id) ret.Msg = fmt.Sprintf(model.Conf.Language(15), id)
return return
} }

View File

@ -48,7 +48,7 @@ func GetDocInfo(rootID string) (ret *BlockInfo) {
tree, err := loadTreeByBlockID(rootID) tree, err := loadTreeByBlockID(rootID)
if nil != err { 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 return
} }