Code Review
/
src
/
xds
/
xds-server.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Use go module as dependency tool instead of glide
[src/xds/xds-server.git]
/
lib
/
syncthing
/
stfolder.go
diff --git
a/lib/syncthing/stfolder.go
b/lib/syncthing/stfolder.go
index
d67b164
..
ca001a3
100644
(file)
--- a/
lib/syncthing/stfolder.go
+++ b/
lib/syncthing/stfolder.go
@@
-1,5
+1,5
@@
/*
/*
- * 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");
* Author Sebastien Douheret <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@
-23,7
+23,7
@@
import (
"path/filepath"
"strings"
"path/filepath"
"strings"
- "g
ithub.com/iotbzh/xds-server
/lib/xsapiv1"
+ "g
errit.automotivelinux.org/gerrit/src/xds/xds-server.git
/lib/xsapiv1"
stconfig "github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/protocol"
)
stconfig "github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/protocol"
)
@@
-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) {
// 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.Errorf("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()
// 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
}
// Add or update Folder settings
- var label, id string
if label = f.Label; label == "" {
label = strings.Split(id, "/")[0]
}
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,
folder := stconfig.FolderConfiguration{
ID: id,