Merge commit '5d4dbbcc67c98007d417cbe67b5a2261889304dc' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2024-06-30 11:25:40 +02:00
commit d2aea85e6c
164 files changed
+1857 -1159

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
HTTP/1.1 301 Moved Permanently
server: nginx
date: Thu, 27 Jun 2024 11:04:53 GMT
content-type: text/html; charset=UTF-8
location: http://example.com/ärgerliche-umlaute.html
+12
View File
@@ -0,0 +1,12 @@
# frozen_string_literal: true
if defined?(Flatware)
Flatware.configure do |config|
config.after_fork do |test_env_number|
unless ENV.fetch('DISABLE_SIMPLECOV', nil) == 'true'
require 'simplecov'
SimpleCov.at_fork.call(test_env_number) # Combines parallel coverage results
end
end
end
end
+6 -2
View File
@@ -210,10 +210,14 @@ RSpec.describe MediaAttachment, :paperclip_processing do
expect(media.file.meta['original']['duration']).to be_within(0.05).of(0.235102)
expect(media.thumbnail.present?).to be true
# NOTE: Our libvips and ImageMagick implementations currently have different results
expect(media.file.meta['colors']['background']).to eq(ENV['MASTODON_USE_LIBVIPS'] ? '#268cd9' : '#3088d4')
expect(media.file.meta['colors']['background']).to eq(expected_background_color)
expect(media.file_file_name).to_not eq 'boop.ogg'
end
def expected_background_color
# The libvips and ImageMagick implementations produce different results
Rails.configuration.x.use_vips ? '#268cd9' : '#3088d4'
end
end
describe 'mp3 with large cover art' do
+1 -1
View File
@@ -9,7 +9,7 @@ describe 'The account show page' do
get '/@alice'
expect(head_link_icons.size).to eq(4) # One general favicon and three with sizes
expect(head_link_icons.size).to eq(3) # Three favicons with sizes
expect(head_meta_content('og:title')).to match alice.display_name
expect(head_meta_content('og:type')).to eq 'profile'
@@ -27,6 +27,7 @@ RSpec.describe FetchLinkCardService do
stub_request(:get, 'http://example.com/koi8-r').to_return(request_fixture('koi8-r.txt'))
stub_request(:get, 'http://example.com/windows-1251').to_return(request_fixture('windows-1251.txt'))
stub_request(:get, 'http://example.com/low_confidence_latin1').to_return(request_fixture('low_confidence_latin1.txt'))
stub_request(:get, 'http://example.com/aergerliche-umlaute').to_return(request_fixture('redirect_with_utf8_url.txt'))
Rails.cache.write('oembed_endpoint:example.com', oembed_cache) if oembed_cache
@@ -101,6 +102,14 @@ RSpec.describe FetchLinkCardService do
end
end
context 'with a redirect URL with faulty encoding' do
let(:status) { Fabricate(:status, text: 'http://example.com/aergerliche-umlaute') }
it 'does not create a preview card' do
expect(status.preview_card).to be_nil
end
end
context 'with a 404 URL' do
let(:status) { Fabricate(:status, text: 'http://example.com/not-found') }
@@ -193,6 +202,19 @@ RSpec.describe FetchLinkCardService do
end
end
context 'with an URL too long for PostgreSQL unique indexes' do
let(:url) { "http://example.com/#{'a' * 2674}" }
let(:status) { Fabricate(:status, text: url) }
it 'does not fetch the URL' do
expect(a_request(:get, url)).to_not have_been_made
end
it 'does not create a preview card' do
expect(status.preview_card).to be_nil
end
end
context 'with a URL of a page with oEmbed support' do
let(:html) { '<!doctype html><title>Hello world</title><link rel="alternate" type="application/json+oembed" href="http://example.com/oembed?url=http://example.com/html">' }
let(:status) { Fabricate(:status, text: 'http://example.com/html') }