Fix activitypub link href checker to ignore no-url

This commit is contained in:
KMY 2023-03-21 22:09:38 +09:00
parent ca3bfbadcb
commit f2e0d5b634

View file

@ -54,11 +54,14 @@ class Sanitize
return unless env[:node_name] == 'a' return unless env[:node_name] == 'a'
current_node = env[:node] current_node = env[:node]
href = current_node['href'] href = current_node['href'] || ''
text = current_node.text text = current_node.text
cls = current_node['class'] || '' cls = current_node['class'] || ''
scheme = if current_node['href'] =~ Sanitize::REGEX_PROTOCOL dot_pos = text.index('.')
return unless dot_pos.present? && dot_pos > 0 && dot_pos < text.size - 1
scheme = if href =~ Sanitize::REGEX_PROTOCOL
Regexp.last_match(1).downcase Regexp.last_match(1).downcase
else else
:relative :relative