Skip to content

Commit 7410f1a

Browse files
author
Tibor Vass
committed
pkg/archive: keep walkRoot clean if source is /
Previously, getWalkRoot("/", "foo") would return "//foo" Now it returns "/foo" Signed-off-by: Tibor Vass <[email protected]>
1 parent 171538c commit 7410f1a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/archive/archive_unix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"errors"
88
"os"
99
"path/filepath"
10+
"strings"
1011
"syscall"
1112

1213
"github.com/docker/docker/pkg/idtools"
@@ -26,7 +27,7 @@ func fixVolumePathPrefix(srcPath string) string {
2627
// can't use filepath.Join(srcPath,include) because this will clean away
2728
// a trailing "." or "/" which may be important.
2829
func getWalkRoot(srcPath string, include string) string {
29-
return srcPath + string(filepath.Separator) + include
30+
return strings.TrimSuffix(srcPath, string(filepath.Separator)) + string(filepath.Separator) + include
3031
}
3132

3233
// CanonicalTarNameForPath returns platform-specific filepath

0 commit comments

Comments
 (0)