Repository related API v4 endpoints return a 403 when the repository is disabled for the project

Summary

When accessing any of the repository/ API endpoints for a project that has the repository disabled, the API will return a 403 Forbidden error. This should return a 404 Not Found, ideally also specifying that this feature has been disabled. Furthermore the projects/ return object should get an additional flag that signals if this feature is enabled or not.

Steps to reproduce

  • Create a new Repository
  • Disable the Repository feature
  • access any of the repository/ API endpoints
$ curl https://gitlab.com/api/v4/projects/12918028/repository/branches
{"message":"403 Forbidden"}

Example Project

https://gitlab.com/audron/issue-test-repo/

What is the current bug behavior?

$ curl https://gitlab.com/api/v4/projects/12918028/repository/branches
{"message":"403 Forbidden"}

What is the expected correct behavior?

$ curl https://gitlab.com/api/v4/projects/12918028/repository/branches
{"message":"404 Not Found"}

Output of checks

This bug happens on GitLab.com

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Assignee Loading
Time tracking Loading