Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

local: fix listings of . on Windows - fixes #3676

Nick Craig-Wood7bf056316fe8
diff --git a/backend/local/local.go b/backend/local/local.go
index fe5f87a2c..2480a4dd6 100644
--- a/backend/local/local.go
+++ b/backend/local/local.go
@@ -1084,17 +1084,17 @@ func (o *Object) Remove(ctx context.Context) error {
func cleanRootPath(s string, noUNC bool) string {
if runtime.GOOS == "windows" {
- s = filepath.ToSlash(s)
- vol := filepath.VolumeName(s)
- s = vol + enc.FromStandardPath(s[len(vol):])
- s = filepath.FromSlash(s)
-
if !filepath.IsAbs(s) && !strings.HasPrefix(s, "\\") {
s2, err := filepath.Abs(s)
if err == nil {
s = s2
}
}
+ s = filepath.ToSlash(s)
+ vol := filepath.VolumeName(s)
+ s = vol + enc.FromStandardPath(s[len(vol):])
+ s = filepath.FromSlash(s)
+
if !noUNC {
// Convert to UNC
s = uncPath(s)
diff --git a/backend/local/tests_test.go b/backend/local/tests_test.go
index fc4f75120..f5ab93fad 100644
--- a/backend/local/tests_test.go
+++ b/backend/local/tests_test.go
@@ -54,7 +54,7 @@ var testsWindows = [][2]string{
{`\\?\UNC\theserver\dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
{`//?/UNC/theserver/dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
{`c:/temp`, `c:\temp`},
- {`/temp/file.txt`, `\temp\file.txt`},
+ {`C:/temp/file.txt`, `C:\temp\file.txt`},
{`c:\!\"#¤%&/()=;:*^?+-`, `c:\!\"#¤%&\()=;:*^?+-`},
{`c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`, `c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`},
}