mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 21:57:19 +00:00
Ignore undefined
as canonical url (#31882)
This commit is contained in:
parent
3d46f47817
commit
ab763c493f
|
@ -225,7 +225,7 @@ class LinkDetailsExtractor
|
|||
end
|
||||
|
||||
def valid_url_or_nil(str, same_origin_only: false)
|
||||
return if str.blank? || str == 'null'
|
||||
return if str.blank? || str == 'null' || str == 'undefined'
|
||||
|
||||
url = @original_url + Addressable::URI.parse(str)
|
||||
|
||||
|
|
|
@ -33,6 +33,14 @@ RSpec.describe LinkDetailsExtractor do
|
|||
expect(subject.canonical_url).to eq original_url
|
||||
end
|
||||
end
|
||||
|
||||
context 'when canonical URL is set to "undefined"' do
|
||||
let(:url) { 'undefined' }
|
||||
|
||||
it 'ignores the canonical URLs' do
|
||||
expect(subject.canonical_url).to eq original_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when only basic metadata is present' do
|
||||
|
|
Loading…
Reference in a new issue