Skip to content

fix(handlers): return a proper error code for invalid import query value

Problem

The import route accepts a pre query parameter that is validated to be either true or false. Any other values raise an error https://gitlab.com/gitlab-org/container-registry/-/blob/19cdecb30d38fc005b721477ea7b4095c0ce3ed2/registry/handlers/import.go#L65 that result in a 500 error response code.

Solution

We should create an instance of ErrorCodeInvalidQueryParamValue and return it in https://gitlab.com/gitlab-org/container-registry/-/blob/19cdecb30d38fc005b721477ea7b4095c0ce3ed2/registry/handlers/import.go#L65 instead of an unknown error

Edited by Jaime Martinez