Don't skip symlinks during local source upload#355
Don't skip symlinks during local source upload#355dollierp wants to merge 1 commit intoshipwright-io:mainfrom
Conversation
Signed-off-by: Denis Ollier <dollierp@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
IrvingMg
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Overall, LGTM. I left a couple of comments. It would also be nice to have unit tests for at least basic cases, as the changes are related to the core functionality of the upload command.
| // skipPath inspect each path and makes sure it skips files the tar helper can't handle. | ||
| func (t *Tar) skipPath(fpath string, stat fs.FileInfo) bool { | ||
| if !stat.Mode().IsRegular() { | ||
| if !stat.Mode().IsRegular() && !(stat.Mode()&fs.ModeSymlink != 0) { |
There was a problem hiding this comment.
| if !stat.Mode().IsRegular() && !(stat.Mode()&fs.ModeSymlink != 0) { | |
| if !stat.Mode().IsRegular() && stat.Mode()&fs.ModeSymlink == 0 { |
nit
| target, err := os.Readlink(fpath) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| header.Linkname = target |
There was a problem hiding this comment.
Should we add validation or a warning if the symlink points outside the source directory?
Changes
Don't skip symlinks during local source upload
/kind bug
Submitter Checklist
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes