Fix branch with # in name fails to fetch commit data
What does this MR do and why?
Recently we opted to use encodeURI
when composing a https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136323 for fetching commit data. This helped to solve our problem with /
being encoded for multi-level subdirectories.
However, as a result it isn't possible to correctly fetch data, when a branch name includes #
. More on this in this comment: #441582 (comment 1904839407)
I decided to keep encodeURI
method for the path, but go back to encodeURIComponent
for the ref.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Create a branch that has
#
sign in its name - On that branch, create a subdirectory that will have a couple of levels of subdirectories. This could be empty folders.
- Go to Repository page and see if the commit data loads correctly.
- Go into the subdirectories you created. Their commit data should also load correctly.
Related to #441582 (closed)