heroku / docker-registry-client

A Go API client for the v2 Docker Registry API
BSD 3-Clause "New" or "Revised" License
297 stars 225 forks source link

hub.Repositories() return s error if there are more repository than fetched per page #82

Open daolis opened 3 years ago

daolis commented 3 years ago

registry.getPaginatedJSON(url, &response) in registry.repositories uses a URL including protocol, and base URL at the fist call and fetches the list of repositories correctly. e.g. url = https://myrepository/v2/_catalog

BUT it returns the URL to fetch the next page without the base URL e.g. /v2/_catalog?last=something&n=100&orderby=

next call to registry.getPaginatedJSON(url, &response) return an error: unsupported protocol scheme ""

I guess the same error will happen for Tags (registry.repositories)

yosensen commented 3 years ago

registry.getPaginatedJSON(url, &response) in registry.repositories uses a URL including protocol, and base URL at the fist call and fetches the list of repositories correctly. e.g. url = https://myrepository/v2/_catalog

BUT it returns the URL to fetch the next page without the base URL e.g. /v2/_catalog?last=something&n=100&orderby=

next call to registry.getPaginatedJSON(url, &response) return an error: unsupported protocol scheme ""

I guess the same error will happen for Tags (registry.repositories)

I fixed it on func (registry *Registry) Repositories() ([]string, error) in repositories.go with

url = strings.ReplaceAll(url, "%", "%%")
url = registry.url(url)

after

url, err = registry.getPaginatedJSON(url, &response)

Maybe the Tags can be fixed with the same way.

annelau21 commented 2 years ago

Bump on this issue - do we know if there is a work-around?