summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-20 05:57:25 -0400
committerGitHub <noreply@github.com>2020-06-20 05:57:25 -0400
commitf403aa3baa23a64e7d6bf3fcbc815644d95b768d (patch)
treeae757f33f5fe2efc4351e5983a8e864cec68250a /libpod
parent60425c96d06c9666e8ba310579a08173aee81839 (diff)
parentb05888a97dbb45a205ff535538ecdd91a19c6ae3 (diff)
downloadpodman-f403aa3baa23a64e7d6bf3fcbc815644d95b768d.tar.gz
podman-f403aa3baa23a64e7d6bf3fcbc815644d95b768d.tar.bz2
podman-f403aa3baa23a64e7d6bf3fcbc815644d95b768d.zip
Merge pull request #6621 from vrothberg/bz-1846629
search: allow wildcards
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/search.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/libpod/image/search.go b/libpod/image/search.go
index f8d45d576..72dba668f 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)