diff options
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/design_management/design_v432x230_uploader.rb | 2 | ||||
-rw-r--r-- | app/uploaders/file_uploader.rb | 4 | ||||
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 2 | ||||
-rw-r--r-- | app/uploaders/packages/nuget/symbol_uploader.rb | 25 |
4 files changed, 29 insertions, 4 deletions
diff --git a/app/uploaders/design_management/design_v432x230_uploader.rb b/app/uploaders/design_management/design_v432x230_uploader.rb index 975050c26e4..0f1ebfed4aa 100644 --- a/app/uploaders/design_management/design_v432x230_uploader.rb +++ b/app/uploaders/design_management/design_v432x230_uploader.rb @@ -20,7 +20,7 @@ module DesignManagement # # 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_ALLOWLIST = %w(image/png image/jpeg image/bmp image/gif).freeze + MIME_TYPE_ALLOWLIST = %w[image/png image/jpeg image/bmp image/gif].freeze process resize_to_fit: [432, 230] diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index 87a624ddb60..c28f0893c56 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -20,8 +20,8 @@ class FileUploader < GitlabUploader '!?\[.*?\]\(/uploads/(?P<secret>[0-9a-f]{32})/(?P<file>.*?)\)' ) - DYNAMIC_PATH_PATTERN = %r{.*(?<secret>\b(\h{10}|\h{32}))\/(?<identifier>.*)}.freeze - VALID_SECRET_PATTERN = %r{\A\h{10,32}\z}.freeze + DYNAMIC_PATH_PATTERN = %r{.*(?<secret>\b(\h{10}|\h{32}))\/(?<identifier>.*)} + VALID_SECRET_PATTERN = %r{\A\h{10,32}\z} InvalidSecret = Class.new(StandardError) diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 06bf742a22d..c1ca535b336 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -5,7 +5,7 @@ class GitlabUploader < CarrierWave::Uploader::Base class_attribute :storage_location_identifier - PROTECTED_METHODS = %i(filename cache_dir work_dir store_dir).freeze + PROTECTED_METHODS = %i[filename cache_dir work_dir store_dir].freeze ObjectNotReadyError = Class.new(StandardError) diff --git a/app/uploaders/packages/nuget/symbol_uploader.rb b/app/uploaders/packages/nuget/symbol_uploader.rb new file mode 100644 index 00000000000..1d6ec9a8de8 --- /dev/null +++ b/app/uploaders/packages/nuget/symbol_uploader.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Packages + module Nuget + class SymbolUploader < GitlabUploader + include ObjectStorage::Concern + + storage_location :packages + + alias_method :upload, :model + + def store_dir + dynamic_segment + end + + private + + def dynamic_segment + raise ObjectNotReadyError, 'Packages::Nuget::Symbol model not ready' unless model.object_storage_key + + model.object_storage_key + end + end + end +end |