浏览代码

lib/model: Fix regression deleting directories on pull (ref #5690) (#5691)

Simon Frei 6 年之前
父节点
当前提交
b45d77b6be
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      lib/model/folder_sendrecv.go

+ 3 - 1
lib/model/folder_sendrecv.go

@@ -513,13 +513,15 @@ func (f *sendReceiveFolder) processDeletions(fileDeletions map[string]protocol.F
 		}
 	}
 
-	for _, dir := range dirDeletions {
+	// Process in reverse order to delete depth first
+	for i := range dirDeletions {
 		select {
 		case <-f.ctx.Done():
 			return
 		default:
 		}
 
+		dir := dirDeletions[len(dirDeletions)-i-1]
 		f.resetPullError(dir.Name)
 		l.Debugln(f, "Deleting dir", dir.Name)
 		f.deleteDir(dir, dbUpdateChan, scanChan)