diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index 0a467a8d9c9b14996407276c4e730a0150d11925..9201003e2e1275d9bf2f49be80922ac3c4a0186f 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