[go: up one dir, main page]

Skip to content

Ensure forward slashes in branch names are encoded

What does this MR do and why?

Ensure forward slashes in branch names are encoded

For History button redirecting to the list of commits, we want a branch name to be able to include a forward slashes. It was reported that redirecting to a commit page, when the url includes non-encoded slashes results in 404.

Since we're generating the history link on the backend, the frontend ensures that we can supplement that ref part of that link with properly encoded string, if ref is available.

References

Screenshots or screen recordings

Blob page

Note that navigating to a specific file on a Commits page did not result in 404. I decided to keep the same behaviour there for the consistency.

Before After
Screen_Recording_2025-07-08_at_12.18.10 Screen_Recording_2025-07-08_at_12.20.10

Tree page

Before After
Screen_Recording_2025-07-08_at_12.17.49 Screen_Recording_2025-07-08_at_12.15.20

How to set up and validate locally

  1. Import this project with a URL option: https://docs.gitlab.com/user/project/import/repo_by_url/
  2. Go to a project.
  3. From a ref selector, choose feature/signatures
  4. From both a tree and blob view, click History button. You should be navigated to Commits page. The url should have %2 in the branch name part, but still / from project's namespace or any folder you're browsing.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #471995 (closed)

Edited by Paulina Sedlak-Jakubowska

Merge request reports

Loading