From 054bc970e2f8d5aaa5f9f5e4355ae33bf3636f53 Mon Sep 17 00:00:00 2001 From: Yannic A Date: Sat, 3 Oct 2015 11:58:55 +0200 Subject: [PATCH] Add trailing folder seperator to allow symlinks as folder path (fixes #1361) --- lib/config/config.go | 3 +++ lib/config/config_test.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/config/config.go b/lib/config/config.go index 78d3fc32d..b56a2c3d6 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -363,6 +363,9 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) { // This way in the tests, we get away without OS specific separators // in the test configs. folder.RawPath = filepath.Dir(folder.RawPath + string(filepath.Separator)) + if folder.RawPath[len(folder.RawPath)-1] != filepath.Separator { + folder.RawPath = folder.RawPath + string(filepath.Separator) + } if folder.ID == "" { folder.ID = "default" diff --git a/lib/config/config_test.go b/lib/config/config_test.go index 626452f89..e17cb8a70 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -91,7 +91,7 @@ func TestDeviceConfig(t *testing.T) { expectedFolders := []FolderConfiguration{ { ID: "test", - RawPath: "testdata", + RawPath: "testdata" + string(filepath.Separator), Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}}, ReadOnly: true, RescanIntervalS: 600, @@ -326,7 +326,7 @@ func TestIssue1262(t *testing.T) { } actual := cfg.Folders()["test"].RawPath - expected := "e:" + expected := "e:/" if runtime.GOOS == "windows" { expected = `e:\` }