lib/model: Fix removal of a marker when there are still folders referencing it (#6114)

This commit is contained in:
Ruslan Yevdokymov 2019-10-30 16:11:07 +01:00 committed by Audrius Butkevicius
parent 56cdf2f2d9
commit 3b5dff3f34

View File

@ -389,8 +389,17 @@ func (m *model) RemoveFolder(cfg config.FolderConfiguration) {
m.fmut.Lock()
defer m.fmut.Unlock()
// Delete syncthing specific files
cfg.Filesystem().RemoveAll(config.DefaultMarkerName)
isPathUnique := true
for folderID, folderCfg := range m.folderCfgs {
if folderID != cfg.ID && folderCfg.Path == cfg.Path {
isPathUnique = false
break
}
}
if isPathUnique {
// Delete syncthing specific files
cfg.Filesystem().RemoveAll(config.DefaultMarkerName)
}
m.tearDownFolderLocked(cfg, fmt.Errorf("removing folder %v", cfg.Description()))
// Remove it from the database