From 6f8558f61a3ff962a6d0c8bcfcf3eea418f1f148 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 28 Oct 2019 15:41:47 +0000 Subject: [PATCH] local: fix listings of . on Windows - fixes #3676 --- backend/local/local.go | 10 +++++----- backend/local/tests_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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:\<>"|?*:&\<>"|?*:&\<>"|?*:&`}, }