*: switch to Get(Root)?ResourcePath where appropriate
Several parts of the codebase didn't use the correct path sanitisation wrappers. Now that the wrappers have been exposed, use those. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
This commit is contained in:
parent
4377ebd6a7
commit
b7c3c0cb69
|
@ -32,7 +32,6 @@ import (
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
"github.com/docker/docker/pkg/progressreader"
|
"github.com/docker/docker/pkg/progressreader"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/docker/docker/pkg/tarsum"
|
"github.com/docker/docker/pkg/tarsum"
|
||||||
"github.com/docker/docker/pkg/urlutil"
|
"github.com/docker/docker/pkg/urlutil"
|
||||||
|
@ -646,14 +645,12 @@ func (b *Builder) addContext(container *daemon.Container, orig, dest string, dec
|
||||||
err error
|
err error
|
||||||
destExists = true
|
destExists = true
|
||||||
origPath = path.Join(b.contextPath, orig)
|
origPath = path.Join(b.contextPath, orig)
|
||||||
destPath = path.Join(container.RootfsPath(), dest)
|
destPath string
|
||||||
)
|
)
|
||||||
|
|
||||||
if destPath != container.RootfsPath() {
|
destPath, err = container.GetResourcePath(dest)
|
||||||
destPath, err = symlink.FollowSymlinkInScope(destPath, container.RootfsPath())
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preserve the trailing '/'
|
// Preserve the trailing '/'
|
||||||
|
|
Loading…
Reference in New Issue