ansible / galaxy-dev

Ansible Automation Hub
11 stars 13 forks source link

Artifact upload sha256 error format is wrong and missing sha256 are ignored #290

Closed ironfroggy closed 4 years ago

ironfroggy commented 4 years ago

Two tests still fail for sha256 handling on artifact upload:

Here is the response when the hash does not match the uploaded artifact:

{
  'status': '400',
  'code': 'invalid',
  'title': 'Invalid input.',
  'detail': 'The provided sha256 value does not match the sha256 of the uploaded file.'
}

Notably, the 'parameter' field is missing.

Secondly, if no hash is provided at all, there is no error, although the OpenAPI spec defines the sha256 parameter as required. Either the spec could be adjusted if we want to leave it optional (as it is in Pulp) or we need to hand back a required code error body.

alikins commented 4 years ago

Secondly, if no hash is provided at all, there is no error, although the OpenAPI spec defines the sha256 parameter as required.

Yeah, it is really optional. Updating spec.

alikins commented 4 years ago

@ironfroggy

The error response body when a hash is invalid is incorrect

Ah, that it is "pulp" style:

{
  "status": "400",
  "code": "invalid",
  "title": "Invalid input.",
  "detail": "The provided sha256 value does not match the sha256 of the uploaded file."
}

and not "galaxy_ns/autohub/galaxy-api" style:

{
  "errors": [
    {
      "code": "invalid",
      "detail": "The provided sha256 value does not match the sha256 of the uploaded file.",
      "title": "Invalid Input",
      "status": "400",
    }
  ]
}

Sounds like something is amiss when the galaxy_pulp / pulp error gets transmogrified to galaxy_ng errors.