From 9865665cb15a1f63e6c4d0623d33b8ef11810f8d Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 8 Oct 2019 12:06:01 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/helpers/diff_helper.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/helpers/diff_helper.rb') diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 7f3e78f3a81..6aafd856423 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -60,9 +60,14 @@ module DiffHelper if line.blank? " ".html_safe else - # We can't use `sub` because the HTML-safeness of `line` will not survive. - line[0] = '' if line.start_with?('+', '-', ' ') - line + # `sub` and substring-ing would destroy HTML-safeness of `line` + if line.start_with?('+', '-', ' ') + line.dup.tap do |line| + line[0] = '' + end + else + line + end end end -- cgit v1.2.1