Skip to content

Fix diff of requirements.txt file by not matching newlines as part of package names

Douwe Maan requested to merge dm-dependency-linker-newlines into master

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/34321

The cause of the problem was that each newline that followed a package name would have an <a> tag around it in the blob content, which meant that when splitting the blob content up into lines, some lines would end in the opening <a> tag, and others would start in the closing </a> tag. When then rendering each line in its own <td> for the diff, the <td> would hold invalid content (half an <a> tag).

Note that there is no XSS issue here: the displayed HTML is all GitLab generated.

Before:

Screen_Shot_2017-06-27_at_14.50.23

After:

Screen_Shot_2017-06-27_at_14.49.58

Merge request reports