Class: DesignManagement::DesignV432x230Uploader

Inherits:
GitlabUploader
  • Object
show all
Includes:
CarrierWave::MiniMagick, ObjectStorage::Concern, 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_WHITELIST =

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

Instance Attribute Summary

Attributes included from RecordsUploads::Concern

#upload

Instance Method Summary collapse

Methods included from ObjectStorage::Concern

#cache!, #delete_migrated_file, #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?, #schedule_background_upload, #store!, #store_dir, #store_dirs, #upload_paths, #use_file

Methods included from RecordsUploads::Concern

#filename, #readd_upload, #record_upload, #upload_path

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, #open, #relative_path, #replace_file_without_saving!, root, storage_options, #work_dir

Constructor Details

This class inherits a constructor from GitlabUploader

Instance Method Details

#content_type_whitelistObject

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_WHITELIST
end

#move_to_cacheObject

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