mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-06 00:57:19 -04:00
Merge pull request #17 from Microsoft/fix_symlink
Backuptar: replace slash with backslash on link target
This commit is contained in:
+1
-1
@@ -284,7 +284,7 @@ func WriteBackupStreamFromTarFile(w io.Writer, t *tar.Reader, hdr *tar.Header) (
|
|||||||
if hdr.Typeflag == tar.TypeSymlink {
|
if hdr.Typeflag == tar.TypeSymlink {
|
||||||
_, isMountPoint := hdr.Winheaders[hdrMountPoint]
|
_, isMountPoint := hdr.Winheaders[hdrMountPoint]
|
||||||
rp := winio.ReparsePoint{
|
rp := winio.ReparsePoint{
|
||||||
Target: hdr.Linkname,
|
Target: filepath.FromSlash(hdr.Linkname),
|
||||||
IsMountPoint: isMountPoint,
|
IsMountPoint: isMountPoint,
|
||||||
}
|
}
|
||||||
reparse := winio.EncodeReparsePoint(&rp)
|
reparse := winio.EncodeReparsePoint(&rp)
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@ func EncodeReparsePoint(rp *ReparsePoint) []byte {
|
|||||||
var ntTarget string
|
var ntTarget string
|
||||||
relative := false
|
relative := false
|
||||||
if strings.HasPrefix(rp.Target, `\\?\`) {
|
if strings.HasPrefix(rp.Target, `\\?\`) {
|
||||||
ntTarget = rp.Target
|
ntTarget = `\??\` + rp.Target[4:]
|
||||||
} else if strings.HasPrefix(rp.Target, `\\`) {
|
} else if strings.HasPrefix(rp.Target, `\\`) {
|
||||||
ntTarget = `\??\UNC\` + rp.Target[2:]
|
ntTarget = `\??\UNC\` + rp.Target[2:]
|
||||||
} else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' {
|
} else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' {
|
||||||
|
|||||||
Reference in New Issue
Block a user