Skip to content
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

fix import not ignoring url path #3622

Merged
merged 1 commit into from
Jul 25, 2019

Conversation

QiWang19
Copy link
Contributor

fix #3609
This PR allows the program to continue if the input is a valid URL.
Podman import used to check filename to only allow tarball path as a file. It should also allow an URL as the doc mentioned.

Signed-off-by: Qi Wang qiwan@redhat.com

@QiWang19
Copy link
Contributor Author

Can I find the URL of image tarball to add test for this?

@rhatdan
Copy link
Member

rhatdan commented Jul 23, 2019

Can you do
file://localhost/Path/to/tar?

@QiWang19
Copy link
Contributor Author

No runtime_img.go downloadFromURL doesn't support this. Get file:///home/qiwan/Documents/img.tar: unsupported protocol scheme "file"

@QiWang19
Copy link
Contributor Author

// ValidURL checks a string urlStr is a url or not
func ValidURL(urlStr string) error {
_, err := url.ParseRequestURI(urlStr)
return errors.Wrapf(err, "invalid url path: %q", urlStr)
Copy link
Collaborator

@haircommander haircommander Jul 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to me that doing this wrapping mean ValidURL always returns error, regardless of if the url is valid. is that the case, or does passing a nil err to wrapf return nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I forget to change when I wrap the error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but yes passing a nil err to wrapf return nil

@haircommander
Copy link
Collaborator

LGTM

@mheon
Copy link
Member

mheon commented Jul 23, 2019

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2019
@mheon
Copy link
Member

mheon commented Jul 23, 2019

Code LGTM

errURL := parse.ValidURL(source)

if errFileName != nil && errURL != nil {
return errors.Errorf("%q, %q invalid tarball path", errFileName, errURL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use a multierror here, maybe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 I'm looking

@QiWang19 QiWang19 force-pushed the checkurl branch 2 times, most recently from 12f055b to 87e4423 Compare July 24, 2019 14:40
@mheon
Copy link
Member

mheon commented Jul 24, 2019

@QiWang19 Not sure what these test failures are, but I don't think they're you - mind rebasing+repushing?

fix containers#3609
Podman import used to check filename to only allow tarball path as a file. It should also allow an url as the doc mentioned. This PR allows the program to continue if the input is a valid URL

Signed-off-by: Qi Wang <qiwan@redhat.com>
@QiWang19
Copy link
Contributor Author

@mheon PTAL

@mheon
Copy link
Member

mheon commented Jul 25, 2019

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vrothberg
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, mheon, QiWang19

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-merge-robot openshift-merge-robot merged commit 1b95ed9 into containers:master Jul 25, 2019
@QiWang19 QiWang19 deleted the checkurl branch June 26, 2020 15:10
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman import url does not work
9 participants