From d80e16bb183f1deb328ff4592afa4c8bfc4e916d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Jul 2025 10:06:36 +0200 Subject: [PATCH] daemon/pkg/registry: remove unused ParseSearchIndexInfo It was only used by the CLI, which now has its own fork. Signed-off-by: Sebastiaan van Stijn --- daemon/pkg/registry/config.go | 4 ---- daemon/pkg/registry/search.go | 27 +-------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/daemon/pkg/registry/config.go b/daemon/pkg/registry/config.go index baa078abdd..e2149cdb21 100644 --- a/daemon/pkg/registry/config.go +++ b/daemon/pkg/registry/config.go @@ -328,10 +328,6 @@ func normalizeIndexName(val string) string { return val } -func hasScheme(reposName string) bool { - return strings.Contains(reposName, "://") -} - func validateHostPort(s string) error { // Split host and port, and in case s can not be split, assume host only host, port, err := net.SplitHostPort(s) diff --git a/daemon/pkg/registry/search.go b/daemon/pkg/registry/search.go index 24dc91ab02..fd8a7c7542 100644 --- a/daemon/pkg/registry/search.go +++ b/daemon/pkg/registry/search.go @@ -83,7 +83,7 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s } func (s *Service) searchUnfiltered(ctx context.Context, term string, limit int, authConfig *registry.AuthConfig, headers http.Header) (*registry.SearchResults, error) { - if hasScheme(term) { + if strings.Contains(term, "://") { return nil, invalidParamf("invalid repository name: repository name (%s) should not have a scheme", term) } @@ -143,28 +143,3 @@ func splitReposSearchTerm(reposName string) (string, string) { } return nameParts[0], nameParts[1] } - -// ParseSearchIndexInfo will use repository name to get back an indexInfo. -// -// TODO(thaJeztah) this function is only used by the CLI, and used to get -// information of the registry (to provide credentials if needed). We should -// move this function (or equivalent) to the CLI, as it's doing too much just -// for that. -func ParseSearchIndexInfo(reposName string) (*registry.IndexInfo, error) { - indexName, _ := splitReposSearchTerm(reposName) - indexName = normalizeIndexName(indexName) - if indexName == IndexName { - return ®istry.IndexInfo{ - Name: IndexName, - Mirrors: []string{}, - Secure: true, - Official: true, - }, nil - } - - return ®istry.IndexInfo{ - Name: indexName, - Mirrors: []string{}, - Secure: !isInsecure(indexName), - }, nil -}