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

This commit is contained in:
Simon Frei 2019-05-06 20:55:26 +02:00 committed by Jakob Borg
parent 79e67b7f79
commit b45d77b6be

View File

@ -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 { select {
case <-f.ctx.Done(): case <-f.ctx.Done():
return return
default: default:
} }
dir := dirDeletions[len(dirDeletions)-i-1]
f.resetPullError(dir.Name) f.resetPullError(dir.Name)
l.Debugln(f, "Deleting dir", dir.Name) l.Debugln(f, "Deleting dir", dir.Name)
f.deleteDir(dir, dbUpdateChan, scanChan) f.deleteDir(dir, dbUpdateChan, scanChan)