manifests: Return UNSUPPORTED when deleting manifests by tag
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>master
							parent
							
								
									1d0ea8ed7b
								
							
						
					
					
						commit
						95f1eea5f5
					
				|  | @ -485,6 +485,11 @@ func (imh *manifestHandler) applyResourcePolicy(manifest distribution.Manifest) | ||||||
| func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) { | func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) { | ||||||
| 	dcontext.GetLogger(imh).Debug("DeleteImageManifest") | 	dcontext.GetLogger(imh).Debug("DeleteImageManifest") | ||||||
| 
 | 
 | ||||||
|  | 	if imh.Tag != "" { | ||||||
|  | 		imh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	manifests, err := imh.Repository.Manifests(imh) | 	manifests, err := imh.Repository.Manifests(imh) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		imh.Errors = append(imh.Errors, err) | 		imh.Errors = append(imh.Errors, err) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue