Increase preview card image size limit from 2MB to 8MB when using libvips (#31904)

This commit is contained in:
Claire 2024-09-14 02:16:02 +02:00 committed by GitHub
parent 5ba3405be4
commit 4b40d13cb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -39,7 +39,7 @@ class PreviewCard < ApplicationRecord
include Attachmentable include Attachmentable
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
LIMIT = 2.megabytes LIMIT = Rails.configuration.x.use_vips ? 8.megabytes : 2.megabytes
BLURHASH_OPTIONS = { BLURHASH_OPTIONS = {
x_comp: 4, x_comp: 4,

View file

@ -3,6 +3,12 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe PreviewCard do RSpec.describe PreviewCard do
describe 'file size limit', :attachment_processing do
it 'is set differently whether vips is enabled or not' do
expect(described_class::LIMIT).to eq(Rails.configuration.x.use_vips ? 8.megabytes : 2.megabytes)
end
end
describe 'validations' do describe 'validations' do
describe 'urls' do describe 'urls' do
it 'allows http schemes' do it 'allows http schemes' do