lib/config: Retain slash at end of path after expanding ~ (fixes #2782)

The various path cleaning operations done in in cleanedPath() removes
it, so we make sure it's added again at the end. This makes adding the
slash in prepare() unnecessary, but keep it anyway for display purposes
(people looking at the config).

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3342
This commit is contained in:
Jakob Borg authored and Audrius Butkevicius committed 2016-06-26 10:17:20 +00:00
1 parent a2dcffcca2
commit b0d03d1f1c
2 files changed
+55

No files matched your search

+6
View File
@@ -168,6 +168,12 @@ func (f *FolderConfiguration) cleanedPath() string {
return `\\?\` + cleaned
}
// If we're not on Windows, we want the path to end with a slash to
// penetrate symlinks. On Windows, paths must not end with a slash.
if runtime.GOOS != "windows" && cleaned[len(cleaned)-1] != filepath.Separator {
cleaned = cleaned + string(filepath.Separator)
}
return cleaned
}