mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
Merge pull request #80 from rchincha/compl
conformance: fix error msg for DELETE MANIFEST
This commit is contained in:
commit
9ecb5cedf3
4 changed files with 12 additions and 3 deletions
|
@ -9,3 +9,8 @@ linters:
|
|||
|
||||
output:
|
||||
format: colored-line-number
|
||||
|
||||
linters-settings:
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
threshold: 200
|
||||
|
|
|
@ -441,8 +441,11 @@ func (rh *RouteHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) {
|
|||
WriteJSON(w, http.StatusBadRequest,
|
||||
NewErrorList(NewError(NAME_UNKNOWN, map[string]string{"name": name})))
|
||||
case errors.ErrManifestNotFound:
|
||||
WriteJSON(w, http.StatusBadRequest,
|
||||
WriteJSON(w, http.StatusNotFound,
|
||||
NewErrorList(NewError(MANIFEST_UNKNOWN, map[string]string{"reference": reference})))
|
||||
case errors.ErrBadManifest:
|
||||
WriteJSON(w, http.StatusBadRequest,
|
||||
NewErrorList(NewError(UNSUPPORTED, map[string]string{"reference": reference})))
|
||||
default:
|
||||
rh.c.Log.Error().Err(err).Msg("unexpected error")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
|
@ -569,7 +569,7 @@ func CheckWorkflows(t *testing.T, config *compliance.Config) {
|
|||
// delete again should fail
|
||||
resp, err = resty.R().Delete(baseURL + "/v2/repo7/manifests/" + digest.String())
|
||||
So(err, ShouldBeNil)
|
||||
So(resp.StatusCode(), ShouldEqual, 400)
|
||||
So(resp.StatusCode(), ShouldEqual, 404)
|
||||
|
||||
// check/get by tag
|
||||
resp, err = resty.R().Head(baseURL + "/v2/repo7/manifests/test:1.0")
|
||||
|
|
|
@ -462,10 +462,11 @@ func (is *ImageStore) DeleteImageManifest(repo string, reference string) error {
|
|||
return errors.ErrRepoNotFound
|
||||
}
|
||||
|
||||
// as per spec "reference" can only be a digest and not a tag
|
||||
_, err := godigest.Parse(reference)
|
||||
if err != nil {
|
||||
is.log.Error().Err(err).Msg("invalid reference")
|
||||
return errors.ErrManifestNotFound
|
||||
return errors.ErrBadManifest
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadFile(path.Join(dir, "index.json"))
|
||||
|
|
Loading…
Reference in a new issue