lib/model: Don't remove non-empty .stfolder (#7578)

This commit is contained in:
Jakob Borg 2021-04-15 18:13:35 +02:00 committed by GitHub
parent 130d14cec9
commit e4c995a321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -475,8 +475,13 @@ func (m *model) removeFolder(cfg config.FolderConfiguration) {
}
}
if isPathUnique {
// Delete syncthing specific files
cfg.Filesystem().RemoveAll(config.DefaultMarkerName)
// Remove (if empty and removable) or move away (if non-empty or
// otherwise not removable) Syncthing-specific marker files.
fs := cfg.Filesystem()
if err := fs.Remove(config.DefaultMarkerName); err != nil {
moved := config.DefaultMarkerName + time.Now().Format(".removed-20060102-150405")
_ = fs.Rename(config.DefaultMarkerName, moved)
}
}
m.cleanupFolderLocked(cfg)