🐛 Notebook data may be corrupted during data synchronization https://github.com/siyuan-note/siyuan/issues/9594

This commit is contained in:
Daniel 2023-11-06 22:13:04 +08:00
parent a721bbe6f0
commit 70c56c8e25
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
24 changed files with 88 additions and 96 deletions

View file

@ -111,7 +111,7 @@ func ListNotebooks() (ret []*Box, err error) {
boxConf := conf.NewBoxConf()
boxDirPath := filepath.Join(util.DataDir, dir.Name())
boxConfPath := filepath.Join(boxDirPath, ".siyuan", "conf.json")
if !gulu.File.IsExist(boxConfPath) {
if !filelock.IsExist(boxConfPath) {
// Automatically move corrupted notebook folders to the corrupted folder https://github.com/siyuan-note/siyuan/issues/9202
logging.LogWarnf("found a corrupted box [%s]", boxDirPath)
to := filepath.Join(util.WorkspaceDir, "corrupted", time.Now().Format("2006-01-02-150405"), dir.Name())
@ -184,7 +184,7 @@ func (box *Box) GetConf() (ret *conf.BoxConf) {
ret = conf.NewBoxConf()
confPath := filepath.Join(util.DataDir, box.ID, ".siyuan/conf.json")
if !gulu.File.IsExist(confPath) {
if !filelock.IsExist(confPath) {
return
}
@ -305,7 +305,7 @@ func (box *Box) Stat(p string) (ret *FileInfo) {
}
func (box *Box) Exist(p string) bool {
return gulu.File.IsExist(filepath.Join(util.DataDir, box.ID, p))
return filelock.IsExist(filepath.Join(util.DataDir, box.ID, p))
}
func (box *Box) Mkdir(path string) error {