diff --git a/lib/excerpt_parser.rb b/lib/excerpt_parser.rb index 133d0875f74..511daa7d872 100644 --- a/lib/excerpt_parser.rb +++ b/lib/excerpt_parser.rb @@ -30,10 +30,14 @@ class ExcerptParser < Nokogiri::XML::SAX::Document end def escape_attribute(v) - v.gsub("&", "&") - .gsub("\"", """) - .gsub("<", "<") - .gsub(">", ">") + return "" unless v + + v = v.dup + v.gsub!("&", "&") + v.gsub!("\"", """) + v.gsub!("<", "<") + v.gsub!(">", ">") + v end def include_tag(name, attributes)