mirror of
https://github.com/rclone/rclone.git
synced 2024-12-24 07:59:07 +01:00
local: fix listings of . on Windows - fixes #3676
This commit is contained in:
parent
520ddbcceb
commit
7bf056316f
@ -1084,17 +1084,17 @@ func (o *Object) Remove(ctx context.Context) error {
|
|||||||
|
|
||||||
func cleanRootPath(s string, noUNC bool) string {
|
func cleanRootPath(s string, noUNC bool) string {
|
||||||
if runtime.GOOS == "windows" {
|
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, "\\") {
|
if !filepath.IsAbs(s) && !strings.HasPrefix(s, "\\") {
|
||||||
s2, err := filepath.Abs(s)
|
s2, err := filepath.Abs(s)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s = s2
|
s = s2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s = filepath.ToSlash(s)
|
||||||
|
vol := filepath.VolumeName(s)
|
||||||
|
s = vol + enc.FromStandardPath(s[len(vol):])
|
||||||
|
s = filepath.FromSlash(s)
|
||||||
|
|
||||||
if !noUNC {
|
if !noUNC {
|
||||||
// Convert to UNC
|
// Convert to UNC
|
||||||
s = uncPath(s)
|
s = uncPath(s)
|
||||||
|
@ -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`},
|
||||||
{`//?/UNC/theserver/dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
|
{`//?/UNC/theserver/dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
|
||||||
{`c:/temp`, `c:\temp`},
|
{`c:/temp`, `c:\temp`},
|
||||||
{`/temp/file.txt`, `\temp\file.txt`},
|
{`C:/temp/file.txt`, `C:\temp\file.txt`},
|
||||||
{`c:\!\"#¤%&/()=;:*^?+-`, `c:\!\"#¤%&\()=;:*^?+-`},
|
{`c:\!\"#¤%&/()=;:*^?+-`, `c:\!\"#¤%&\()=;:*^?+-`},
|
||||||
{`c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`, `c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`},
|
{`c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`, `c:\<>"|?*:&\<>"|?*:&\<>"|?*:&`},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user