diff options
Diffstat (limited to 'lib/syncthing/stfolder.go')
-rw-r--r-- | lib/syncthing/stfolder.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/syncthing/stfolder.go b/lib/syncthing/stfolder.go index d67b164..1dcbfe1 100644 --- a/lib/syncthing/stfolder.go +++ b/lib/syncthing/stfolder.go @@ -70,6 +70,12 @@ func (s *SyncThing) FolderLoadFromStConfig(f *[]xsapiv1.FolderConfig) error { // FolderChange is called when configuration has changed func (s *SyncThing) FolderChange(f xsapiv1.FolderConfig) (string, error) { + var label, id string + + if id = f.ID; id == "" { + s.log.Errorln("Try to create Syncthing folder with null ID: %v", f) + return "", fmt.Errorf("Cannot create Syncthing folder (ID must be set") + } // Get current config stCfg, err := s.ConfigGet() @@ -104,13 +110,9 @@ func (s *SyncThing) FolderChange(f xsapiv1.FolderConfig) (string, error) { } // Add or update Folder settings - var label, id string if label = f.Label; label == "" { label = strings.Split(id, "/")[0] } - if id = f.ID; id == "" { - id = stClientID[0:15] + "_" + label - } folder := stconfig.FolderConfiguration{ ID: id, |