diff options
| author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-25 17:49:08 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-25 17:49:08 +0200 | 
| commit | 1b95ed9a71faff063edef34bc2ba5d89eab66a2b (patch) | |
| tree | dc3cb0555500fafef28d0385f5810de6bbbc2055 /cmd/podman/shared/parse | |
| parent | 7c9095ea1de363f8d76ae246575062755ac9398e (diff) | |
| parent | a328e873c67af2cc469f57b3dc34b46a0f799558 (diff) | |
| download | podman-1b95ed9a71faff063edef34bc2ba5d89eab66a2b.tar.gz podman-1b95ed9a71faff063edef34bc2ba5d89eab66a2b.tar.bz2 podman-1b95ed9a71faff063edef34bc2ba5d89eab66a2b.zip | |
Merge pull request #3622 from QiWang19/checkurl
fix import not ignoring url path
Diffstat (limited to 'cmd/podman/shared/parse')
| -rw-r--r-- | cmd/podman/shared/parse/parse.go | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/cmd/podman/shared/parse/parse.go b/cmd/podman/shared/parse/parse.go index a77002235..9fbc92fc3 100644 --- a/cmd/podman/shared/parse/parse.go +++ b/cmd/podman/shared/parse/parse.go @@ -7,6 +7,7 @@ import (  	"bufio"  	"fmt"  	"net" +	"net/url"  	"os"  	"regexp"  	"strings" @@ -162,3 +163,12 @@ func ValidateFileName(filename string) error {  	}  	return nil  } + +// ValidURL checks a string urlStr is a url or not +func ValidURL(urlStr string) error { +	_, err := url.ParseRequestURI(urlStr) +	if err != nil { +		return errors.Wrapf(err, "invalid url path: %q", urlStr) +	} +	return nil +} | 
