Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante and natalieparellano committed Nov 15, 2023
1 parent 21d309e commit 9c53229
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ func WriteDirToTar(tw TarWriter, srcDir, basePath string, uid, gid int, mode int
return err
}

if previousPath, ok := hardLinkFiles[inode]; ok {
if processedPath, ok := hardLinkFiles[inode]; ok {
header.Typeflag = tar.TypeLink
header.Linkname = previousPath
header.Linkname = processedPath
header.Size = 0
} else {
hardLinkFiles[inode] = header.Name
Expand Down
3 changes: 1 addition & 2 deletions pkg/buildpack/buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ func toDistTar(tw archive.TarWriter, descriptor Descriptor, blob Blob) error {
header.Name = path.Join(baseTarDir, header.Name)

if header.Typeflag == tar.TypeLink {
header.Linkname = path.Clean(header.Linkname)
header.Linkname = path.Join(baseTarDir, header.Linkname)
header.Linkname = path.Join(baseTarDir, path.Clean(header.Linkname))
}
err = tw.WriteHeader(header)
if err != nil {
Expand Down

0 comments on commit 9c53229

Please sign in to comment.