Skip to content

Broken merge request template selection when name contains parenthesis characters

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When selecting a merge request template with a ( or ) in it's name, selecting a merge request template has no effect.

Steps to reproduce

Create a merge request template with a ( or ) in it's name, for example .gitlab/merge_request_templates/Feature (Monitoring).md

Example Project

https://gitlab.com/Trainmaster/broken-merge-request-template/-/merge_requests/new?merge_request%5Bsource_branch%5D=test&merge_request%5Bsource_project_id%5D=25181217&merge_request%5Btarget_branch%5D=master&merge_request%5Btarget_project_id%5D=25181217

What is the current bug behavior?

The template is not copied to the description field. The loading spinner does not disappear. The browser console displays Error: Request failed with status code 404.

What is the expected correct behavior?

The template is copied to the description field. The loading spinner disappears. The browser console should not show a 404 error.

Relevant logs and/or screenshots

trycatch.js:220 GET https://gitlab.com/api/v4/projects/25181217/templates/merge_requests/Feature%20(Monitoring)?source_template_project_id=25181217 404
createError.js:16 Uncaught (in promise) Error: Request failed with status code 404
    at t.exports (createError.js:16)
    at t.exports (settle.js:17)
    at XMLHttpRequest.p.onreadystatechange (xhr.js:69)
    at XMLHttpRequest.r (helpers.js:72)

Possible fixes

Properly encode ( and ). The following URL works:

https://gitlab.com/api/v4/projects/25181217/templates/merge_requests/Feature%20%28Monitoring%29?source_template_project_id=25181217

Edited by 🤖 GitLab Bot 🤖