Commit a844b1b9 authored by Luke Duncalfe's avatar Luke Duncalfe

Skip generating smaller designs for TIFFs

Our ability to enable the feature to generate smaller design images
https://gitlab.com/gitlab-org/gitlab/-/issues/207351 was blocked when it
was discovered that our servers did not have the ability to generate
JPG or TIFF https://gitlab.com/gitlab-org/gitlab/-/issues/207740.

The developer who is working on allowing our infrastructure to resize
images has enabled JPGs to be resized in production, however TIFF
support may take a couple more weeks
https://gitlab.com/gitlab-org/gitlab/-/issues/207740#note_316655702.

We've decided to make a change to skip resizing TIFFs for now, and then
go ahead and enable the resizing feature, rather than to hold it up any
longer. We can then do a follow-up issue to enable TIFF when we have it.

https://gitlab.com/gitlab-org/gitlab/-/issues/213468
parent 35b18fe2
......@@ -12,9 +12,15 @@ module DesignManagement
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
# We currently cannot resize `image/ico` or `image/svg+xml` mime types.
# See https://gitlab.com/gitlab-org/gitlab/issues/207069
MIME_TYPE_WHITELIST = %w(image/png image/jpeg image/bmp image/gif image/tiff).freeze
# We choose not to resize `image/ico` as we assume there will be no
# benefit in generating an 432x230 sized icon.
#
# We currently cannot resize `image/tiff`.
# See https://gitlab.com/gitlab-org/gitlab/issues/207740
#
# We currently choose not to resize `image/svg+xml` for security reasons.
# See https://gitlab.com/gitlab-org/gitlab/issues/207740#note_302766171
MIME_TYPE_WHITELIST = %w(image/png image/jpeg image/bmp image/gif).freeze
process resize_to_fit: [432, 230]
......
......@@ -15,6 +15,14 @@ describe DesignManagement::GenerateImageVersionsService do
.from(nil).to(CarrierWave::SanitizedFile)
end
it 'skips generating image versions if the mime type is not whitelisted' do
stub_const('DesignManagement::DesignV432x230Uploader::MIME_TYPE_WHITELIST', [])
described_class.new(version).execute
expect(action.reload.image_v432x230.file).to eq(nil)
end
it 'skips generating image versions if the design file size is too large' do
stub_const("#{described_class.name}::MAX_DESIGN_SIZE", 1.byte)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment