Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 15:06:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 15:06:01 +0300
commit9865665cb15a1f63e6c4d0623d33b8ef11810f8d (patch)
tree25458d0f21cf25896af750ed6933bbc4efcdb909 /app/helpers/diff_helper.rb
parent77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb11
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?
"&nbsp;".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