diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-15 07:53:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-15 07:53:28 -0400 |
commit | 5262c53598ea579db0487587f60f088c68dc1190 (patch) | |
tree | 4acfcbf240b01297adeb9f90b381c5e11d52c5de /libpod | |
parent | 373ba8c017a0b5d298a0f53e60bd2069df0173a6 (diff) | |
parent | 660208cea38fdebb302f674b40bfd755f02def2d (diff) | |
download | podman-5262c53598ea579db0487587f60f088c68dc1190.tar.gz podman-5262c53598ea579db0487587f60f088c68dc1190.tar.bz2 podman-5262c53598ea579db0487587f60f088c68dc1190.zip |
Merge pull request #6921 from vrothberg/2.0-wildcard-search
[2.0] search: allow wildcards
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/image/search.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libpod/image/search.go b/libpod/image/search.go index 0950921ed..ee1ff0312 100644 --- a/libpod/image/search.go +++ b/libpod/image/search.go @@ -64,13 +64,16 @@ type SearchFilter struct { // SearchImages searches images based on term and the specified SearchOptions // in all registries. func SearchImages(term string, options SearchOptions) ([]SearchResult, error) { - // Check if search term has a registry in it - registry, err := sysreg.GetRegistry(term) - if err != nil { - return nil, errors.Wrapf(err, "error getting registry from %q", term) - } - if registry != "" { - term = term[len(registry)+1:] + registry := "" + + // Try to extract a registry from the specified search term. We + // consider everything before the first slash to be the registry. Note + // that we cannot use the reference parser from the containers/image + // library as the search term may container arbitrary input such as + // wildcards. See bugzilla.redhat.com/show_bug.cgi?id=1846629. + if spl := strings.SplitN(term, "/", 2); len(spl) > 1 { + registry = spl[0] + term = spl[1] } registries, err := getRegistries(registry) |