summaryrefslogtreecommitdiff
path: root/cmd/podman/import.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-07-22 15:15:38 -0400
committerQi Wang <qiwan@redhat.com>2019-07-24 11:41:48 -0400
commita328e873c67af2cc469f57b3dc34b46a0f799558 (patch)
treeafa67aa2008fda148f97f4b2b694cb9ed2caffb9 /cmd/podman/import.go
parent2283471f8da7c3dc1a2cc6e1fe908c0fe7596d68 (diff)
downloadpodman-a328e873c67af2cc469f57b3dc34b46a0f799558.tar.gz
podman-a328e873c67af2cc469f57b3dc34b46a0f799558.tar.bz2
podman-a328e873c67af2cc469f57b3dc34b46a0f799558.zip
fix import not ignoring url path
fix #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>
Diffstat (limited to 'cmd/podman/import.go')
-rw-r--r--cmd/podman/import.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/import.go b/cmd/podman/import.go
index 70ea167cb..d49792f27 100644
--- a/cmd/podman/import.go
+++ b/cmd/podman/import.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared/parse"
"github.com/containers/libpod/pkg/adapter"
+ multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -69,8 +70,11 @@ func importCmd(c *cliconfig.ImportValues) error {
return errors.Errorf("too many arguments. Usage TARBALL [REFERENCE]")
}
- if err := parse.ValidateFileName(source); err != nil {
- return err
+ errFileName := parse.ValidateFileName(source)
+ errURL := parse.ValidURL(source)
+
+ if errFileName != nil && errURL != nil {
+ return multierror.Append(errFileName, errURL)
}
quiet := c.Quiet