Browse Source

Fix TagManager#local_url? erroring out on invalid URL (#18580)

closed-social-glitch-2
Claire 2 years ago
committed by GitHub
parent
commit
28212bd2be
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      app/lib/tag_manager.rb

+ 3
- 0
app/lib/tag_manager.rb View File

@ -24,8 +24,11 @@ class TagManager
def local_url?(url) def local_url?(url)
uri = Addressable::URI.parse(url).normalize uri = Addressable::URI.parse(url).normalize
return false unless uri.host
domain = uri.host + (uri.port ? ":#{uri.port}" : '') domain = uri.host + (uri.port ? ":#{uri.port}" : '')
TagManager.instance.web_domain?(domain) TagManager.instance.web_domain?(domain)
rescue Addressable::URI::InvalidURIError
false
end end
end end

Loading…
Cancel
Save