Skip to content

Commit

Permalink
Merge pull request #1845 from giuseppe/chunked-preserve-symlinks-value
Browse files Browse the repository at this point in the history
chunked: preserve the original value for symlinks
  • Loading branch information
openshift-merge-bot[bot] authored Feb 27, 2024
2 parents 8a4fb72 + 69aeb17 commit 23f2830
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/chunked/storage_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1819,13 +1819,17 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff

mode := os.FileMode(r.Mode)

r.Name = filepath.Clean(r.Name)
r.Linkname = filepath.Clean(r.Linkname)

t, err := typeToTarType(r.Type)
if err != nil {
return output, err
}

r.Name = filepath.Clean(r.Name)
// do not modify the value of symlinks
if r.Linkname != "" && t != tar.TypeSymlink {
r.Linkname = filepath.Clean(r.Linkname)
}

if whiteoutConverter != nil {
hdr := archivetar.Header{
Typeflag: t,
Expand Down

0 comments on commit 23f2830

Please sign in to comment.