pkg/bindings/images.nTar(): slashify hdr.Name values

When setting path names in the build context archive, convert path names
to use forward slashes, as is normal for those archives, so that
directory hierarchies archived on Windows hosts extract correctly
everywhere.

Not really sure how to run the remote client in CI on a system that uses
`\` as a path separator, which is where this error crops up, so
[NO TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai
2021-08-18 09:52:56 -04:00
parent a3d8b48fd5
commit aeffdb05d1

View File

@ -481,9 +481,9 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
return nil // skip root dir return nil // skip root dir
} }
name := strings.TrimPrefix(path, s+string(filepath.Separator)) name := filepath.ToSlash(strings.TrimPrefix(path, s+string(filepath.Separator)))
excluded, err := pm.Matches(filepath.ToSlash(name)) // nolint:staticcheck excluded, err := pm.Matches(name) // nolint:staticcheck
if err != nil { if err != nil {
return errors.Wrapf(err, "error checking if %q is excluded", name) return errors.Wrapf(err, "error checking if %q is excluded", name)
} }