summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-07-18 11:02:19 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-07-18 13:11:46 +0200
commit0c2da7f7348095ae6babeee230484f7f9c59ea62 (patch)
treeb600949e434013700786c8e688ad18f6d5d52ebf /lib
parent240a4aa62ab24a8a7b5545dee6bd2cf00ad7596e (diff)
downloadgitlab-ce-0c2da7f7348095ae6babeee230484f7f9c59ea62.tar.gz
Don't parse Rinku returned value to DocFragment when it didn't change the original html string.18593-avoid-parse_html-when-rinku-didnt-do-anything
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/autolink_filter.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/banzai/filter/autolink_filter.rb b/lib/banzai/filter/autolink_filter.rb
index fac7dad3243..9ed45707515 100644
--- a/lib/banzai/filter/autolink_filter.rb
+++ b/lib/banzai/filter/autolink_filter.rb
@@ -56,6 +56,8 @@ module Banzai
# period (e.g., http://localhost:3000/)
rinku = Rinku.auto_link(html, :urls, options, IGNORE_PARENTS.to_a, 1)
+ return if rinku == html
+
# Rinku returns a String, so parse it back to a Nokogiri::XML::Document
# for further processing.
@doc = parse_html(rinku)