mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:17:32 +00:00
Add workaround for YouTube Shorts links (#17869)
* Add workaround for YouTube Shorts links * Update link_details_extractor_spec.rb
This commit is contained in:
parent
9565b17d5d
commit
b58db8f12e
|
@ -208,7 +208,7 @@ class LinkDetailsExtractor
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_url_or_nil(str, same_origin_only: false)
|
def valid_url_or_nil(str, same_origin_only: false)
|
||||||
return if str.blank?
|
return if str.blank? || str == 'null'
|
||||||
|
|
||||||
url = @original_url + Addressable::URI.parse(str)
|
url = @original_url + Addressable::URI.parse(str)
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,14 @@ RSpec.describe LinkDetailsExtractor do
|
||||||
expect(subject.canonical_url).to eq 'https://foo.com/article'
|
expect(subject.canonical_url).to eq 'https://foo.com/article'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when canonical URL is set to "null"' do
|
||||||
|
let(:html) { '<!doctype html><link rel="canonical" href="null" />' }
|
||||||
|
|
||||||
|
it 'ignores the canonical URLs' do
|
||||||
|
expect(subject.canonical_url).to eq original_url
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when structured data is present' do
|
context 'when structured data is present' do
|
||||||
|
|
Loading…
Reference in a new issue