lib/config: Reject empty folder IDs

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4698
LGTM: imsodin
This commit is contained in:
Jakob Borg
2018-01-27 09:06:37 +00:00
parent 20e05cdcd0
commit e0931e201e
2 changed files with 47 additions and 5 deletions

View File

@@ -260,6 +260,10 @@ func (cfg *Configuration) clean() error {
folder := &cfg.Folders[i]
folder.prepare()
if folder.ID == "" {
return fmt.Errorf("folder with empty ID in configuration")
}
if _, ok := seenFolders[folder.ID]; ok {
return fmt.Errorf("duplicate folder ID %q in configuration", folder.ID)
}