Windows: Fix absolute checks

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-08-26 16:39:16 -07:00
parent 65841492f0
commit f012ac7b5a
2 changed files with 5 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import (
"strings" "strings"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/system"
) )
// Errors used or returned by this file. // Errors used or returned by this file.
@ -210,7 +211,7 @@ func CopyInfoDestinationPath(path string) (info CopyInfo, err error) {
return CopyInfo{}, err return CopyInfo{}, err
} }
if !filepath.IsAbs(linkTarget) { if !system.IsAbs(linkTarget) {
// Join with the parent directory. // Join with the parent directory.
dstParent, _ := SplitPathDirEntry(path) dstParent, _ := SplitPathDirEntry(path)
linkTarget = filepath.Join(dstParent, linkTarget) linkTarget = filepath.Join(dstParent, linkTarget)

View file

@ -12,6 +12,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/docker/docker/pkg/system"
) )
// FollowSymlinkInScope is a wrapper around evalSymlinksInScope that returns an // FollowSymlinkInScope is a wrapper around evalSymlinksInScope that returns an
@ -120,7 +122,7 @@ func evalSymlinksInScope(path, root string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
if filepath.IsAbs(dest) { if system.IsAbs(dest) {
b.Reset() b.Reset()
} }
path = dest + string(filepath.Separator) + path path = dest + string(filepath.Separator) + path