mirror of https://github.com/tootsuite/mastodon
Increase preview card image size limit from 2MB to 8MB when using libvips (#31904)
parent
5ba3405be4
commit
4b40d13cb3
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue