Newlines in custom server hook error messages render improperly in merge UI
Summary
Newlines in custom system hook error messages do not render correctly in the merge request UI on attempted merge.
Steps to reproduce
Create a new repository with an empty README.md
. Create a new branch within that repository with some arbitrary content and submit a merge request.
Then create a custom hook within the given repository with a multiple messages, as follows:
#!/bin/sh
echo "GL-HOOK-ERR: User is ${GL_ID}"
echo "GL-HOOK-ERR: Do better."
exit 1
Finally attempt to merge that MR.
What is the current bug behavior?
Newlines are replaced and rendered as literal <br>
but not rendered as html (so are displayed literally).
What is the expected correct behavior?
Messages should be displayed on separate lines, as appropriate.
Relevant logs and/or screenshots
How it should (and does display in the edit/commit UI):
Possible fixes
Relevant bit of code, but not necessarily where to fix this:
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/utils.rb#L94
Edited by Ben Brown