diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:01 +0000 |
commit | 9865665cb15a1f63e6c4d0623d33b8ef11810f8d (patch) | |
tree | 25458d0f21cf25896af750ed6933bbc4efcdb909 /app/helpers/diff_helper.rb | |
parent | 77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (diff) | |
download | gitlab-ce-9865665cb15a1f63e6c4d0623d33b8ef11810f8d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r-- | app/helpers/diff_helper.rb | 11 |
1 files changed, 8 insertions, 3 deletions
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 |