Skip to content

Fix the `/projects/:id/repository/branches endpoint` to handle dots in the branch name when the project full patch contains a `/`

username-removed-128633 requested to merge rc/fix-branches-api-endpoint into master

What does this MR do?

Part 1 of #15651 (closed). This allows to make API requests for branches that contains a . when the project full patch contains a /.

Are there points in the code the reviewer needs to double check?

This includes a potential breaking change, that I consider being a bugfix:

  • currently GET /api/v4/projects/gitlab-org%2Fgitlab-ce/repository/branches/rc/sidekiq-test-mode returns the branch information
  • POST /api/v4/projects/gitlab-org%2Fgitlab-ce/repository/branches/rc/sidekiq-test-mode/protect works as well because there are not conflicting routes
  • For instance, this breaks for GET /api/v4/projects/13083/repository/branches/rc/sidekiq-test-mode/commits
  • I believe this is a bug and branch names should be always be escaped, i.e. rc%2Fsidekiq-test-mode

I will follow this MR with an MR for the tags and the commits endpoints.

Why was this MR needed?

Because branches that contain a . couldn't be dealt with when the project full patch contains a /.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

Edited by username-removed-128633

Merge request reports