Fix exception when trying to serialize posts with <a> tags in them without hrefs (#1334)

* fix exception when trying to serialize posts with <a> tags in them without hrefs

* Add tests

Co-authored-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
Ben Lubar
2020-05-28 05:47:40 -05:00
committed by GitHub
parent c8cee24cb3
commit ead09f5ddc
3 changed files with 30 additions and 11 deletions

View File

@ -55,7 +55,7 @@ class Sanitize
end
LINK_REL_TRANSFORMER = lambda do |env|
return unless env[:node_name] == 'a'
return unless env[:node_name] == 'a' and env[:node]['href']
node = env[:node]

View File

@ -32,6 +32,7 @@ class TagManager
def local_url?(url)
uri = Addressable::URI.parse(url).normalize
return false unless uri.host
domain = uri.host + (uri.port ? ":#{uri.port}" : '')
TagManager.instance.web_domain?(domain)