New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add/copy: make sure we handle relative path names correctly #5050
add/copy: make sure we handle relative path names correctly #5050
Conversation
Make sure that `add` and `copy` handle relative paths given as input correctly, both with and without a context directory being specified. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
if err != nil { | ||
return fmt.Errorf("computing path of %q relative to %q: %w", glob, contextDir, err) | ||
rel := glob | ||
if filepath.IsAbs(glob) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? We only append contextDir, if the glob is a Absolute path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't appended - we're conditionalizing whether or not we want to convert the matched value to a relative path. We don't need to do that when it's already a relative path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I understand.
LGTM |
1 similar comment
LGTM |
/lgtm |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Make sure that
add
andcopy
handle relative paths given as input correctly, both with and without a context directory being specified.How to verify it
New integration tests!
Which issue(s) this PR fixes:
Fixes #5049.
Special notes for your reviewer:
Does this PR introduce a user-facing change?