mirror of https://github.com/rclone/rclone.git
Minor adjustments to Unc path conversion function.
This commit is contained in:
parent
6fbd9cf24b
commit
3234c28f7c
|
@ -638,8 +638,8 @@ func filterPath(s string) string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pattern to match a windows absolute path: c:\temp path.
|
// Pattern to match a windows absolute path: "c:\" and similar
|
||||||
var isAbsWinDrive = regexp.MustCompile(`[a-zA-Z]\:\\`)
|
var isAbsWinDrive = regexp.MustCompile(`^[a-zA-Z]\:\\`)
|
||||||
|
|
||||||
// uncPath converts an absolute Windows path
|
// uncPath converts an absolute Windows path
|
||||||
// to a UNC long path.
|
// to a UNC long path.
|
||||||
|
@ -653,10 +653,11 @@ func uncPath(s string) string {
|
||||||
if strings.HasPrefix(s, `\\?\`) {
|
if strings.HasPrefix(s, `\\?\`) {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
// Trim "//" from path and add UNC prefix.
|
|
||||||
|
// Trim "\\" from path and add UNC prefix.
|
||||||
return `\\?\UNC\` + strings.TrimPrefix(s, `\\`)
|
return `\\?\UNC\` + strings.TrimPrefix(s, `\\`)
|
||||||
}
|
}
|
||||||
if isAbsWinDrive.Match([]byte(s)) {
|
if isAbsWinDrive.MatchString(s) {
|
||||||
return `\\?\` + s
|
return `\\?\` + s
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|
Loading…
Reference in New Issue