Merge pull request #23049 from vdemeester/search-validate-before-call

Validate filter values before calling registry.
This commit is contained in:
Brian Goff 2016-05-27 10:21:40 -04:00
commit ab9204c826

View file

@ -32,11 +32,6 @@ func (daemon *Daemon) SearchRegistryForImages(ctx context.Context, filtersArgs s
return nil, err
}
unfilteredResult, err := daemon.RegistryService.Search(ctx, term, authConfig, dockerversion.DockerUserAgent(ctx), headers)
if err != nil {
return nil, err
}
var isAutomated, isOfficial bool
var hasStarFilter = 0
if searchFilters.Include("is-automated") {
@ -66,6 +61,11 @@ func (daemon *Daemon) SearchRegistryForImages(ctx context.Context, filtersArgs s
}
}
unfilteredResult, err := daemon.RegistryService.Search(ctx, term, authConfig, dockerversion.DockerUserAgent(ctx), headers)
if err != nil {
return nil, err
}
filteredResults := []registrytypes.SearchResult{}
for _, result := range unfilteredResult.Results {
if searchFilters.Include("is-automated") {