This commit is contained in:
Liang Ding 2022-10-09 09:57:54 +08:00
parent 8cef519539
commit f3413cb583
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
8 changed files with 22 additions and 18 deletions

View file

@ -37,7 +37,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/qiniu/go-sdk/v7 v7.13.0
github.com/radovskyb/watcher v1.0.7
github.com/siyuan-note/dejavu v0.0.0-20221008180903-80366e53821a
github.com/siyuan-note/dejavu v0.0.0-20221009014342-57351eb27c75
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da
github.com/siyuan-note/filelock v0.0.0-20221007163134-7e64809023ef

View file

@ -345,10 +345,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
github.com/siyuan-note/dejavu v0.0.0-20220930021019-e62491947339 h1:jePYjiGBPa5Qs8bCdlPDrRzfNxr0FJ+rQYv/d6H5p8A=
github.com/siyuan-note/dejavu v0.0.0-20220930021019-e62491947339/go.mod h1:Y+bg0j0Z7C66oJWPPYMs+wZuFeiTRWhh2aLkqctJFKk=
github.com/siyuan-note/dejavu v0.0.0-20221008180903-80366e53821a h1:5zn/SFVvih7nwr8bRB9qeZ9NHfjSUA9dneEMqNzsPps=
github.com/siyuan-note/dejavu v0.0.0-20221008180903-80366e53821a/go.mod h1:Y+bg0j0Z7C66oJWPPYMs+wZuFeiTRWhh2aLkqctJFKk=
github.com/siyuan-note/dejavu v0.0.0-20221009014342-57351eb27c75 h1:4aExF0IlFsBj+54knKzWfr+9FVui4lzua/fwXqjKmjQ=
github.com/siyuan-note/dejavu v0.0.0-20221009014342-57351eb27c75/go.mod h1:Y+bg0j0Z7C66oJWPPYMs+wZuFeiTRWhh2aLkqctJFKk=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90=

View file

@ -682,15 +682,21 @@ func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar,
})
if errors.Is(err, dejavu.ErrNotFoundObject) {
logging.LogWarnf("data repo is corrupted, try to reset it")
resetErr := os.RemoveAll(filepath.Join(repo.Path))
if nil != resetErr {
logging.LogErrorf("reset data repo failed: %s", resetErr)
logging.LogErrorf("remove data repo failed: %s", resetErr)
return
}
logging.LogWarnf("data repo has been reset caused by not found object")
index, err = repo.Index("[Sync] Cloud sync", map[string]interface{}{
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar,
})
logging.LogWarnf("data repo has been reset")
go func() {
time.Sleep(5 * time.Second)
util.PushMsg(Conf.Language(105), 5000)
}()
}
if nil != err {