Skip to content

Fix tag delete response body

João Pereira requested to merge fix-tag-delete-response into master

While working on the test suite I realized that we have two problems with the tag delete route when the target repository does not exist:

  1. When filesystem mirroring is disabled (we only query the DB), we're returning a 500 Internal Server Error response code, although the body error is NAME_UNKNOWN. The response code should be 404 Not Found.

  2. When using the filesystem, we're returning a 404 Not Found but the response body error is MANIFEST_UNKNOWN. This is like so since we introduced the tag delete route, and I believe it was the case because there was no function to build a repository root path. Now we have repositoryRootPathSpec, which we introduced for the migration proxy feature, so we can fix the response body code by doing a stat against this path before attempting to delete the tag. Although we're changing an existing response body, the status code remains the same (and that's the only thing GitLab Rails cares about on these responses). I think this can be considered a fix and not a breaking change because of this and the fact that the body error code is incorrect.

This MR adds a test for tag deletes with unknown repositories and makes the response of both filesystem and database consistent by using a NAME_UNKNOWN error.

Merge request reports

Loading