summaryrefslogtreecommitdiff
path: root/cmd/podman/parse/net.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-07-22 09:31:53 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-07-23 10:21:37 +0200
commitdcb5c92c0d94c81f0706cd282b55a2a9d1fde30f (patch)
tree964a8fc0f95ce13a630fda943d039ad4f4a74a59 /cmd/podman/parse/net.go
parent6370622444676db812cbc54aef56e691ea7788d0 (diff)
downloadpodman-dcb5c92c0d94c81f0706cd282b55a2a9d1fde30f.tar.gz
podman-dcb5c92c0d94c81f0706cd282b55a2a9d1fde30f.tar.bz2
podman-dcb5c92c0d94c81f0706cd282b55a2a9d1fde30f.zip
import: write stdin to tmp file
If importing an archive via stdin write it to a temporary file such that the temporary file can be opened multiple times later on. Otherwise, we may end up with an empty image. Also fix a bug in the URL parsing code; we need to check whether there's actually a scheme. Add system tests for `podman import` exercising the basics. Fixes: #10994 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/parse/net.go')
-rw-r--r--cmd/podman/parse/net.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/podman/parse/net.go b/cmd/podman/parse/net.go
index f93c4ab1e..870690db3 100644
--- a/cmd/podman/parse/net.go
+++ b/cmd/podman/parse/net.go
@@ -180,9 +180,12 @@ func ValidateFileName(filename string) error {
// ValidURL checks a string urlStr is a url or not
func ValidURL(urlStr string) error {
- _, err := url.ParseRequestURI(urlStr)
+ url, err := url.ParseRequestURI(urlStr)
if err != nil {
- return errors.Wrapf(err, "invalid url path: %q", urlStr)
+ return errors.Wrapf(err, "invalid url %q", urlStr)
+ }
+ if url.Scheme == "" {
+ return errors.Errorf("invalid url %q: missing scheme", urlStr)
}
return nil
}