distribution/distribution

Tag listing API Fails: 404 error unknown repository, although the repo is being listed in the catalog API.

arshh-d opened this issue · 1 comments

Description

After deleting the last tag, if we try to list the tags within the same repo, 404 error is returned with message repository is unknown. even though the repo is being listed in the catalog api response

Reproduce

  1. delete the last tag within the repo
  2. list tags of the repo

response:

{
    "errors": [
        {
            "code": "NAME_UNKNOWN",
            "message": "repository name not known to registry",
            "detail": {
                "name": "<name>/<tag>"
            }
        }
    ]
}

Expected behavior

if there are no tags present for the given repo, we may consider returning empty list instead of 404 for repository.

registry version

version - v3.0.0

Additional Info

code reference
if the _manifests/tags/ directory is empty PathNotFoundError is returned.
Instead of returning ErrRepositoryUnknown for the above case we can skip this check to return empty tag list.

Yeah making this change could be....complicated as we might break other people's tools since that's the current behaviour and it's compliant with the spec: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-tags

The list of tags MAY be empty if there are no tags on the repository

The spec itself is just a pile of sadness so I empathise with you.