mirror of
https://github.com/containers/podman.git
synced 2025-12-12 01:38:04 +08:00
update c/buildah to v1.12.0
Also bump docker/docker. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
committed by
Valentin Rothberg
parent
6c7b6d994a
commit
63bda55c1f
65
vendor/github.com/containers/buildah/imagebuildah/stage_executor.go
generated
vendored
65
vendor/github.com/containers/buildah/imagebuildah/stage_executor.go
generated
vendored
@@ -423,38 +423,43 @@ func (s *StageExecutor) Copy(excludes []string, copies ...imagebuilder.Copy) err
|
||||
}
|
||||
for _, src := range copy.Src {
|
||||
if strings.HasPrefix(src, "http://") || strings.HasPrefix(src, "https://") {
|
||||
// Source is a URL.
|
||||
// returns an error to be compatible with docker
|
||||
return errors.Errorf("source can't be a URL for COPY")
|
||||
}
|
||||
// Treat the source, which is not a URL, as a
|
||||
// location relative to the
|
||||
// all-content-comes-from-below-this-directory
|
||||
// directory.
|
||||
srcSecure, err := securejoin.SecureJoin(contextDir, src)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "forbidden path for %q, it is outside of the build context %q", src, contextDir)
|
||||
}
|
||||
if hadFinalPathSeparator {
|
||||
// If destination is a folder, we need to take extra care to
|
||||
// ensure that files are copied with correct names (since
|
||||
// resolving a symlink may result in a different name).
|
||||
_, srcName := filepath.Split(src)
|
||||
_, srcNameSecure := filepath.Split(srcSecure)
|
||||
if srcName != srcNameSecure {
|
||||
options := buildah.AddAndCopyOptions{
|
||||
Chown: copy.Chown,
|
||||
ContextDir: contextDir,
|
||||
Excludes: copyExcludes,
|
||||
IDMappingOptions: idMappingOptions,
|
||||
}
|
||||
if err := s.builder.Add(filepath.Join(copy.Dest, srcName), copy.Download, options, srcSecure); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
// Source is a URL, allowed for ADD but not COPY.
|
||||
if copy.Download {
|
||||
sources = append(sources, src)
|
||||
} else {
|
||||
// returns an error to be compatible with docker
|
||||
return errors.Errorf("source can't be a URL for COPY")
|
||||
}
|
||||
} else {
|
||||
// Treat the source, which is not a URL, as a
|
||||
// location relative to the
|
||||
// all-content-comes-from-below-this-directory
|
||||
// directory.
|
||||
srcSecure, err := securejoin.SecureJoin(contextDir, src)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "forbidden path for %q, it is outside of the build context %q", src, contextDir)
|
||||
}
|
||||
if hadFinalPathSeparator {
|
||||
// If destination is a folder, we need to take extra care to
|
||||
// ensure that files are copied with correct names (since
|
||||
// resolving a symlink may result in a different name).
|
||||
_, srcName := filepath.Split(src)
|
||||
_, srcNameSecure := filepath.Split(srcSecure)
|
||||
if srcName != srcNameSecure {
|
||||
options := buildah.AddAndCopyOptions{
|
||||
Chown: copy.Chown,
|
||||
ContextDir: contextDir,
|
||||
Excludes: copyExcludes,
|
||||
IDMappingOptions: idMappingOptions,
|
||||
}
|
||||
if err := s.builder.Add(filepath.Join(copy.Dest, srcName), copy.Download, options, srcSecure); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
sources = append(sources, srcSecure)
|
||||
}
|
||||
sources = append(sources, srcSecure)
|
||||
}
|
||||
options := buildah.AddAndCopyOptions{
|
||||
Chown: copy.Chown,
|
||||
|
||||
Reference in New Issue
Block a user