cmd/syncthing, lib/model: Handle rel/abs paths for config/protected paths (fixes #3183)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3995
This commit is contained in:
Simon Frei 2017-03-04 07:49:48 +00:00 committed by Jakob Borg
parent 3475a9ab0a
commit c20d612736
2 changed files with 9 additions and 2 deletions

View File

@ -344,7 +344,13 @@ func main() {
if options.confDir != "" {
// Not set as default above because the string can be really long.
baseDirs["config"] = options.confDir
if !filepath.IsAbs(options.confDir) {
path, err := filepath.Abs(options.confDir)
if err != nil {
l.Fatalln(err)
}
baseDirs["config"] = path
}
}
if err := expandLocations(); err != nil {

View File

@ -285,7 +285,8 @@ func (m *Model) warnAboutOverwritingProtectedFiles(folder string) {
}
// check if file is ignored
if ignores.Match(protectedFilePath).IsIgnored() {
relPath, _ := filepath.Rel(folderLocation, protectedFilePath)
if ignores.Match(relPath).IsIgnored() {
continue
}