This commit is contained in:
Liang Ding 2022-10-09 02:22:36 +08:00
parent 57b3373df1
commit 421a80071f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 15 additions and 1 deletions

View file

@ -681,6 +681,18 @@ func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {
index, err := repo.Index("[Sync] Cloud sync", map[string]interface{}{
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar,
})
if errors.Is(err, dejavu.ErrNotFoundObject) {
resetErr := os.RemoveAll(filepath.Join(repo.Path))
if nil != resetErr {
logging.LogErrorf("reset 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,
})
}
if nil != err {
msg := fmt.Sprintf(Conf.Language(140), formatErrorMsg(err))
util.PushStatusBar(msg)