Class: DesignManagement::DesignV432x230Uploader
- Inherits:
-
GitlabUploader
- Object
- CarrierWave::Uploader::Base
- GitlabUploader
- DesignManagement::DesignV432x230Uploader
- Includes:
- CarrierWave::MiniMagick, ObjectStorage::Concern, ObjectStorage::Extension::RecordsUploads, RecordsUploads::Concern
- Defined in:
- app/uploaders/design_management/design_v432x230_uploader.rb
Overview
This Uploader is used to generate and serve the smaller versions of the design files.
The original (full-sized) design files are stored in Git LFS, and so have a different uploader, ‘LfsObjectUploader`.
Constant Summary collapse
- MIME_TYPE_ALLOWLIST =
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 gitlab.com/gitlab-org/gitlab/issues/207740
We currently choose not to resize ‘image/svg+xml` for security reasons. See gitlab.com/gitlab-org/gitlab/issues/207740#note_302766171
%w[image/png image/jpeg image/bmp image/gif].freeze
Constants inherited from GitlabUploader
GitlabUploader::ObjectNotReadyError, GitlabUploader::PROTECTED_METHODS
Instance Attribute Summary
Attributes included from RecordsUploads::Concern
Instance Method Summary collapse
-
#content_type_whitelist ⇒ Object
Allow CarrierWave to reject files without correct mimetypes.
-
#move_to_cache ⇒ Object
Override ‘GitlabUploader` and always return false, otherwise local `LfsObject` files would be deleted.
Methods included from ObjectStorage::Concern
#cache!, #delete_migrated_file, #delete_tmp_file_after_storage, #exclusive_lease_key, #exists?, #file_cache_storage?, #file_storage?, #filename, #filename=, #fog_attributes, #fog_credentials, #fog_directory, #fog_public, #migrate!, #object_store, #object_store=, #persist_object_store!, #persist_object_store?, #retrieve_from_store!, #store!, #store_dir, #store_dirs, #store_path, #upload_paths, #use_file, #use_open_file
Methods included from Gitlab::Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods included from RecordsUploads::Concern
#filename, #readd_upload, #record_upload, #upload_path
Methods included from ObjectStorage::Extension::RecordsUploads
#build_upload, #exclusive_lease_key, #retrieve_from_store!, #upload=
Methods inherited from GitlabUploader
absolute_path, base_dir, #cache_dir, #cached_size, #exists?, #file_cache_storage?, file_storage?, #filename, #initialize, #local_url, #model_valid?, #move_to_store, #multi_read, #open, #options, options, #relative_path, #replace_file_without_saving!, root, storage_location, #url_or_file_path, version, #work_dir
Constructor Details
This class inherits a constructor from GitlabUploader
Instance Method Details
#content_type_whitelist ⇒ Object
Allow CarrierWave to reject files without correct mimetypes.
28 29 30 |
# File 'app/uploaders/design_management/design_v432x230_uploader.rb', line 28 def content_type_whitelist MIME_TYPE_ALLOWLIST end |
#move_to_cache ⇒ Object
Override ‘GitlabUploader` and always return false, otherwise local `LfsObject` files would be deleted. github.com/carrierwaveuploader/carrierwave/blob/f84672a/lib/carrierwave/uploader/cache.rb#L131-L135
35 36 37 |
# File 'app/uploaders/design_management/design_v432x230_uploader.rb', line 35 def move_to_cache false end |