0
0
Fork 0

Do not pass unknown encoding names to nokogiri. (#30987)

This commit is contained in:
David Roetzel 2024-07-10 16:25:39 +02:00 committed by GitHub
parent 36592d10aa
commit 2ea9336b68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View file

@ -32,6 +32,7 @@ RSpec.describe FetchLinkCardService do
stub_request(:get, 'http://example.com/aergerliche-umlaute').to_return(request_fixture('redirect_with_utf8_url.txt'))
stub_request(:get, 'http://example.com/page_without_title').to_return(request_fixture('page_without_title.txt'))
stub_request(:get, 'http://example.com/long_canonical_url').to_return(request_fixture('long_canonical_url.txt'))
stub_request(:get, 'http://example.com/alternative_utf8_spelling_in_header').to_return(request_fixture('alternative_utf8_spelling_in_header.txt'))
Rails.cache.write('oembed_endpoint:example.com', oembed_cache) if oembed_cache
@ -292,6 +293,14 @@ RSpec.describe FetchLinkCardService do
expect(status.preview_card).to be_nil
end
end
context 'with a URL where the `Content-Type` header uses `utf8` instead of `utf-8`' do
let(:status) { Fabricate(:status, text: 'test http://example.com/alternative_utf8_spelling_in_header') }
it 'does not create a preview card' do
expect(status.preview_card.title).to eq 'Webserver Configs R Us'
end
end
end
context 'with a remote status' do