1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 07:43:03 +00:00

fs: cleanup fixpath

This commit is contained in:
Michael Eischer 2024-10-31 21:13:58 +01:00
parent 33da501c35
commit 15b7fb784f

View file

@ -18,19 +18,19 @@ func fixpath(name string) string {
abspath, err := filepath.Abs(name)
if err == nil {
// Check if \\?\UNC\ already exist
if strings.HasPrefix(abspath, `\\?\UNC\`) {
if strings.HasPrefix(abspath, uncPathPrefix) {
return abspath
}
// Check if \\?\ already exist
if strings.HasPrefix(abspath, `\\?\`) {
if strings.HasPrefix(abspath, extendedPathPrefix) {
return abspath
}
// Check if path starts with \\
if strings.HasPrefix(abspath, `\\`) {
return strings.Replace(abspath, `\\`, `\\?\UNC\`, 1)
return strings.Replace(abspath, `\\`, uncPathPrefix, 1)
}
// Normal path
return `\\?\` + abspath
return extendedPathPrefix + abspath
}
return name
}