🎨 使用第三方同步盘时弹出提示并退出内核 https://github.com/siyuan-note/siyuan/issues/7683

This commit is contained in:
Liang Ding 2023-03-19 00:12:28 +08:00
parent d7473b7a6d
commit 5f6d1eac9a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
17 changed files with 69 additions and 171 deletions

View file

@ -24,7 +24,6 @@ import (
"github.com/88250/gulu"
"github.com/88250/lute/html"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
@ -195,11 +194,12 @@ func checkBlockExist(c *gin.Context) {
id := arg["id"].(string)
b, err := model.GetBlock(id, nil)
if errors.Is(err, filelock.ErrUnableAccessFile) {
ret.Code = 2
ret.Data = id
return
}
// TODO 文件被锁的情况已经在 filelock 中做了退出进程处理,不会走到应用层,所以 code 为 2 的情况应该移除
//if errors.Is(err, filelock.ErrUnableAccessFile) {
// ret.Code = 2
// ret.Data = id
// return
//}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 0
ret.Data = false
@ -405,11 +405,11 @@ func getBlockInfo(c *gin.Context) {
id := arg["id"].(string)
tree, err := model.LoadTreeByID(id)
if errors.Is(err, filelock.ErrUnableAccessFile) {
ret.Code = 2
ret.Data = id
return
}
//if errors.Is(err, filelock.ErrUnableAccessFile) {
// ret.Code = 2
// ret.Data = id
// return
//}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
ret.Msg = model.Conf.Language(56)
@ -438,11 +438,11 @@ func getBlockInfo(c *gin.Context) {
}
root, err := model.GetBlock(block.RootID, tree)
if errors.Is(err, filelock.ErrUnableAccessFile) {
ret.Code = 2
ret.Data = id
return
}
//if errors.Is(err, filelock.ErrUnableAccessFile) {
// ret.Code = 2
// ret.Data = id
// return
//}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
ret.Data = model.Conf.Language(56)