Skip to content

Commit

Permalink
Read link target when compressing a symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
rkoster committed Nov 14, 2024
1 parent cf8b67b commit 0968557
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fileutil/tarball_compressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ func (c tarballCompressor) CompressSpecificFilesInDir(dir string, files []string
return nil
}

header, err := tar.FileInfoHeader(fi, "")
link := ""
if fi.Mode()&fs.ModeSymlink != 0 {
link, err = os.Readlink(f)
if err != nil {
return bosherr.WrapError(err, "Reading symlink target")
}
}

header, err := tar.FileInfoHeader(fi, link)
if err != nil {
return bosherr.WrapError(err, "Reading tar header")
}
Expand Down

0 comments on commit 0968557

Please sign in to comment.