/*
- * Copyright (C) 2017 "IoT.bzh"
+ * Copyright (C) 2017-2018 "IoT.bzh"
* Author Sebastien Douheret <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
"path/filepath"
"strings"
- "github.com/iotbzh/xds-server/lib/xsapiv1"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
stconfig "github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/protocol"
)
// 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()
}
// 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,