mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
Merge pull request #3184 from mat007/fix-windows
Fix path separator on Windows
This commit is contained in:
commit
0532b2889a
@ -454,7 +454,7 @@ func filesystem(m Moby, tw *tar.Writer, idMap map[string]uint32) error {
|
|||||||
return errors.New("Did not specify path for file")
|
return errors.New("Did not specify path for file")
|
||||||
}
|
}
|
||||||
// tar archives should not have absolute paths
|
// tar archives should not have absolute paths
|
||||||
if f.Path[0] == os.PathSeparator {
|
if f.Path[0] == '/' {
|
||||||
f.Path = f.Path[1:]
|
f.Path = f.Path[1:]
|
||||||
}
|
}
|
||||||
mode := int64(0600)
|
mode := int64(0600)
|
||||||
|
@ -58,11 +58,11 @@ func tarPrefix(path string, tw tarWriter) error {
|
|||||||
if path == "" {
|
if path == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if path[len(path)-1] != byte('/') {
|
if path[len(path)-1] != '/' {
|
||||||
return fmt.Errorf("path does not end with /: %s", path)
|
return fmt.Errorf("path does not end with /: %s", path)
|
||||||
}
|
}
|
||||||
path = path[:len(path)-1]
|
path = path[:len(path)-1]
|
||||||
if path[0] == byte('/') {
|
if path[0] == '/' {
|
||||||
return fmt.Errorf("path should be relative: %s", path)
|
return fmt.Errorf("path should be relative: %s", path)
|
||||||
}
|
}
|
||||||
mkdir := ""
|
mkdir := ""
|
||||||
@ -85,7 +85,7 @@ func tarPrefix(path string, tw tarWriter) error {
|
|||||||
// ImageTar takes a Docker image and outputs it to a tar stream
|
// ImageTar takes a Docker image and outputs it to a tar stream
|
||||||
func ImageTar(ref *reference.Spec, prefix string, tw tarWriter, trust bool, pull bool, resolv string) (e error) {
|
func ImageTar(ref *reference.Spec, prefix string, tw tarWriter, trust bool, pull bool, resolv string) (e error) {
|
||||||
log.Debugf("image tar: %s %s", ref, prefix)
|
log.Debugf("image tar: %s %s", ref, prefix)
|
||||||
if prefix != "" && prefix[len(prefix)-1] != byte('/') {
|
if prefix != "" && prefix[len(prefix)-1] != '/' {
|
||||||
return fmt.Errorf("prefix does not end with /: %s", prefix)
|
return fmt.Errorf("prefix does not end with /: %s", prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user