Wrong response from /api/v4/projects/:id/packages on private instance

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

On a private instance we get the wrong response when not providing any PRIVATE-TOKEN header:

$ curl https://your-gitlab/api/v4/projects/:id/packages

{"message":"404 Project Not Found"}
$ curl --header "PRIVATE-TOKEN: bad_token" https://your-gitlab/api/v4/projects/:id/packages
{"message":"401 Unauthorized"}
$ curl --header "PRIVATE-TOKEN: good_token" https://your-gitlab/api/v4/projects/:id/packages
[{ EXPECTED JSON RESPONSE HERE }]

When making a request to the endpoint with no PRIVATE-TOKEN header set it should also return a 401 error.

Edited by 🤖 GitLab Bot 🤖