|
@@ -27,11 +27,16 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
|
|
- // TODO(thaJeztah): the "is-automated" field is deprecated; reset the field for the next release (v26.0.0). Return early when using "is-automated=true", and ignore "is-automated=false".
|
|
|
|
isAutomated, err := searchFilters.GetBoolOrDefault("is-automated", false)
|
|
isAutomated, err := searchFilters.GetBoolOrDefault("is-automated", false)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // "is-automated" is deprecated and filtering for `true` will yield no results.
|
|
|
|
+ if isAutomated {
|
|
|
|
+ return []registry.SearchResult{}, nil
|
|
|
|
+ }
|
|
|
|
+
|
|
isOfficial, err := searchFilters.GetBoolOrDefault("is-official", false)
|
|
isOfficial, err := searchFilters.GetBoolOrDefault("is-official", false)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
@@ -51,7 +56,6 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // TODO(thaJeztah): the "is-automated" field is deprecated. Reset the field for the next release (v26.0.0) if any "true" values are present.
|
|
|
|
unfilteredResult, err := s.searchUnfiltered(ctx, term, limit, authConfig, headers)
|
|
unfilteredResult, err := s.searchUnfiltered(ctx, term, limit, authConfig, headers)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
@@ -59,11 +63,6 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s
|
|
|
|
|
|
filteredResults := []registry.SearchResult{}
|
|
filteredResults := []registry.SearchResult{}
|
|
for _, result := range unfilteredResult.Results {
|
|
for _, result := range unfilteredResult.Results {
|
|
- if searchFilters.Contains("is-automated") {
|
|
|
|
- if isAutomated != result.IsAutomated { //nolint:staticcheck // ignore SA1019 for old API versions.
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
if searchFilters.Contains("is-official") {
|
|
if searchFilters.Contains("is-official") {
|
|
if isOfficial != result.IsOfficial {
|
|
if isOfficial != result.IsOfficial {
|
|
continue
|
|
continue
|
|
@@ -74,6 +73,10 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // "is-automated" is deprecated and the value in Docker Hub search
|
|
|
|
+ // results is untrustworthy. Force it to false so as to not mislead our
|
|
|
|
+ // clients.
|
|
|
|
+ result.IsAutomated = false //nolint:staticcheck // ignore SA1019 (field is deprecated)
|
|
filteredResults = append(filteredResults, result)
|
|
filteredResults = append(filteredResults, result)
|
|
}
|
|
}
|
|
|
|
|