summaryrefslogtreecommitdiffstats
path: root/lib/syncthing/stfolder.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-16 00:10:14 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-16 00:10:14 +0100
commit285332c351777b74abca638b8b2a2cde3c68edc6 (patch)
treece52d6d347f23a944520a6b239f8099de75e1a41 /lib/syncthing/stfolder.go
parent963931e04d44a5b40d38817163f52f56241a9f33 (diff)
Fixed and improved events management.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/syncthing/stfolder.go')
-rw-r--r--lib/syncthing/stfolder.go10
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,