mirror of
https://github.com/restic/restic.git
synced 2024-12-22 15:57:07 +00:00
fs: add correct vss support to fixpath
Paths that only contain the volume shadow copy snapshot name require special treatment. These paths must end with a slash for regular file operations to work.
This commit is contained in:
parent
15b7fb784f
commit
03aad742d3
1 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,15 @@ func fixpath(name string) string {
|
||||||
if strings.HasPrefix(abspath, uncPathPrefix) {
|
if strings.HasPrefix(abspath, uncPathPrefix) {
|
||||||
return abspath
|
return abspath
|
||||||
}
|
}
|
||||||
|
// Check if \\?\GLOBALROOT exists which marks volume shadow copy snapshots
|
||||||
|
if strings.HasPrefix(abspath, globalRootPrefix) {
|
||||||
|
if strings.Count(abspath, `\`) == 5 {
|
||||||
|
// Append slash if this just a volume name, e.g. `\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopyXX`
|
||||||
|
// Without the trailing slash any access to the volume itself will fail.
|
||||||
|
return abspath + string(filepath.Separator)
|
||||||
|
}
|
||||||
|
return abspath
|
||||||
|
}
|
||||||
// Check if \\?\ already exist
|
// Check if \\?\ already exist
|
||||||
if strings.HasPrefix(abspath, extendedPathPrefix) {
|
if strings.HasPrefix(abspath, extendedPathPrefix) {
|
||||||
return abspath
|
return abspath
|
||||||
|
|
Loading…
Reference in a new issue