Commit 32543f3b authored by Douwe Maan's avatar Douwe Maan

More escaping!

parent 0ca74f7a
...@@ -102,7 +102,7 @@ module Banzai ...@@ -102,7 +102,7 @@ module Banzai
project = project_from_ref(project_ref) project = project_from_ref(project_ref)
if project && object = find_object(project, id) if project && object = find_object(project, id)
title = escape_once(object_link_title(object)) title = object_link_title(object)
klass = reference_class(object_sym) klass = reference_class(object_sym)
data = data_attribute( data = data_attribute(
...@@ -114,11 +114,11 @@ module Banzai ...@@ -114,11 +114,11 @@ module Banzai
url = matches[:url] if matches.names.include?("url") url = matches[:url] if matches.names.include?("url")
url ||= url_for_object(object, project) url ||= url_for_object(object, project)
text = link_text || escape_once(object_link_text(object, matches)) text = link_text || object_link_text(object, matches)
%(<a href="#{url}" #{data} %(<a href="#{url}" #{data}
title="#{title}" title="#{escape_once(title)}"
class="#{klass}">#{text}</a>) class="#{klass}">#{escape_once(text)}</a>)
else else
match match
end end
......
...@@ -44,7 +44,7 @@ module Banzai ...@@ -44,7 +44,7 @@ module Banzai
# Returns a String # Returns a String
def data_attribute(attributes = {}) def data_attribute(attributes = {})
attributes[:reference_filter] = self.class.name.demodulize attributes[:reference_filter] = self.class.name.demodulize
attributes.map { |key, value| %Q(data-#{key.to_s.dasherize}="#{value}") }.join(" ") attributes.map { |key, value| %Q(data-#{key.to_s.dasherize}="#{escape_once(value)}") }.join(" ")
end end
def escape_once(html) def escape_once(html)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment