Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/uploads_actions.rb')
-rw-r--r--app/controllers/concerns/uploads_actions.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb
index e98d36854f1..0ba13896631 100644
--- a/app/controllers/concerns/uploads_actions.rb
+++ b/app/controllers/concerns/uploads_actions.rb
@@ -5,7 +5,7 @@ module UploadsActions
include Gitlab::Utils::StrongMemoize
include SendFileUpload
- UPLOAD_MOUNTS = %w(avatar attachment file logo header_logo favicon).freeze
+ UPLOAD_MOUNTS = %w[avatar attachment file logo header_logo favicon].freeze
included do
prepend_before_action :set_request_format_from_path_extension
@@ -73,11 +73,11 @@ module UploadsActions
def set_request_format_from_path_extension
path = request.headers['action_dispatch.original_path'] || request.headers['PATH_INFO']
- if match = path&.match(/\.(\w+)\z/)
- format = Mime[match.captures.first]
+ return unless match = path&.match(/\.(\w+)\z/)
- request.format = format.symbol if format
- end
+ format = Mime[match.captures.first]
+
+ request.format = format.symbol if format
end
def content_disposition
@@ -102,14 +102,13 @@ module UploadsActions
end
def uploader
- strong_memoize(:uploader) do
- if uploader_mounted?
- model.public_send(upload_mount) # rubocop:disable GitlabSecurity/PublicSend
- else
- build_uploader_from_upload || build_uploader_from_params
- end
+ if uploader_mounted?
+ model.public_send(upload_mount) # rubocop:disable GitlabSecurity/PublicSend
+ else
+ build_uploader_from_upload || build_uploader_from_params
end
end
+ strong_memoize_attr :uploader
# rubocop: disable CodeReuse/ActiveRecord
def build_uploader_from_upload
@@ -163,8 +162,9 @@ module UploadsActions
end
def model
- strong_memoize(:model) { find_model }
+ find_model
end
+ strong_memoize_attr :model
def workhorse_authorize_request?
action_name == 'authorize'