diff --git a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb index 26977ba4..cb7d5930 100644 --- a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb +++ b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb @@ -123,9 +123,9 @@ module HTML5 if val_unescaped =~ /^[a-z0-9][-+.a-z0-9]*:/ and !self.class.const_get("ALLOWED_PROTOCOLS").include?(val_unescaped.split(':')[0]) attrs.delete attr end - SVG_ATTR_VAL_ALLOWS_REF.each do |attr| - attrs.delete attr if attrs[attr].to_s.downcase =~ /url\(\s*[^#]/m - end + end + SVG_ATTR_VAL_ALLOWS_REF.each do |attr| + attrs[attr] = attrs[attr].to_s.gsub(/url\s*\(\s*[^#\s][^)]+?\)/m, ' ') if attrs[attr] end if attrs['style'] attrs['style'] = sanitize_css(attrs['style']) diff --git a/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat b/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat index 6ef50d41..7d2bb904 100644 --- a/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat +++ b/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat @@ -424,15 +424,15 @@ { "name": "absolute_uri_refs_in_svg_attributes", - "input": "", - "rexml": "", - "xhtml": "", - "output": "" + "input": "", + "rexml": "", + "xhtml": "", + "output": "" }, { "name": "uri_ref_with_space_in svg_attribute", - "input": "", + "input": "", "rexml": "", "xhtml": "", "output": "" @@ -441,8 +441,8 @@ { "name": "absolute_uri_ref_with_space_in svg_attribute", "input": "", - "rexml": "", - "xhtml": "", - "output": "" + "rexml": "", + "xhtml": "", + "output": "" } ]