Merge requests fail where branch contains a # symbol
Summary
When we call GitLab: Crete new merge request on current branch command, branch with # doesn't get escaped causing incorrect branch name
Steps to reproduce
- Create
test-#-hashbranch and push a commit to the remote. - Run
GitLab: Crete new merge request on current branchcommand
What is the current bug behavior?
The branch name appears unescaped in the URL:
http://127.0.0.1:3000/root/empty-test-2/-/merge_requests/new?merge_request%5Bsource_branch%5D=test-#-hash
The #-hash gets treated as the browser ID fragment.
What is the expected correct behavior?
The # is encoded and we open the MR with the following URL:
http://127.0.0.1:3000/root/empty-test-2/-/merge_requests/new?merge_request[source_branch]=test-%23-hash
Relevant logs and/or screenshots
Possible fixes
Probably calling encodeURIComponent(branchName); is enough to fix the issue.
Edited by Tomas Vik (OOO back on 2026-01-05)
