Commit cffc28ec authored by Lin Jen-Shin's avatar Lin Jen-Shin

Strip before passing to addressable, otherwise it's invalid

parent 87328fa9
...@@ -73,8 +73,9 @@ module Banzai ...@@ -73,8 +73,9 @@ module Banzai
return unless node.has_attribute?('href') return unless node.has_attribute?('href')
begin begin
node['href'] = node['href'].strip
uri = Addressable::URI.parse(node['href']) uri = Addressable::URI.parse(node['href'])
uri.scheme = uri.scheme.strip.downcase if uri.scheme uri.scheme = uri.scheme.downcase if uri.scheme
node.remove_attribute('href') if UNSAFE_PROTOCOLS.include?(uri.scheme) node.remove_attribute('href') if UNSAFE_PROTOCOLS.include?(uri.scheme)
rescue Addressable::URI::InvalidURIError rescue Addressable::URI::InvalidURIError
......
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