summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-09-19 22:45:24 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-09-19 22:45:24 -0700
commitae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba (patch)
tree9e20e371d3f5c00d63a0ef62418a851d2027fd2b /lib
parent01974185a1640ed869417131d062b5a2eef620bc (diff)
parent345c4d2a776c3e30d0c05e5954adbfe4142f3519 (diff)
downloadgitlab-ce-ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba.tar.gz
Merge pull request #1512 from tsigo/escape_gfm
Better escaping of text passed into GFM
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/markdown.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 0a467a8d9c9..9201003e2e1 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -48,8 +48,10 @@ module Gitlab
def gfm(text, html_options = {})
return text if text.nil?
- # prevents the string supplied through the _text_ argument to be altered
- text = text.dup
+ # Duplicate the string so we don't alter the original, then call to_str
+ # to cast it back to a String instead of a SafeBuffer. This is required
+ # for gsub calls to work as we need them to.
+ text = text.dup.to_str
@html_options = html_options