Skip to content

Commit

Permalink
manifests: Return UNSUPPORTED when deleting manifests by tag
Browse files Browse the repository at this point in the history
The OCI distribution spec allows implementations to support deleting manifests
by tag, but also permits returning the `UNSUPPORTED` error code for such
requests. docker/distribution has never supported deleting manifests by tag, but
previously returned `DIGEST_INVALID`.

The `Tag` and `Digest` fields of the `manifestHandler` are already correctly
populated based on which kind of reference was given in the request URL. Return
`UNSUPPORTED` if the `Tag` field is populated.

Signed-off-by: Adam Wolfe Gordon <awg@digitalocean.com>
  • Loading branch information
adamwg committed Jun 2, 2020
1 parent 742aab9 commit d19edab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions registry/handlers/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ func (imh *manifestHandler) applyResourcePolicy(manifest distribution.Manifest)
func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) {
dcontext.GetLogger(imh).Debug("DeleteImageManifest")

if imh.Tag != "" {
imh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported)
return
}

manifests, err := imh.Repository.Manifests(imh)
if err != nil {
imh.Errors = append(imh.Errors, err)
Expand Down

0 comments on commit d19edab

Please sign in to comment.