summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/uploads_actions.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-03-02 15:41:40 +0000
committerMicaƫl Bergeron <mbergeron@gitlab.com>2018-03-08 09:25:56 -0500
commit2387ef2b4a9944749f0cd1db5c7e7f55f3745780 (patch)
treeaf51290e8b3e26f702bbd320eeb194126470fa44 /app/controllers/concerns/uploads_actions.rb
parent960b6337cbaaf6a7dad2232c3722010f305eee82 (diff)
downloadgitlab-ce-2387ef2b4a9944749f0cd1db5c7e7f55f3745780.tar.gz
Merge branch 'poc-upload-hashing-path' into 'master'
File uploads on objects storage should use hashed storage Closes #4952 See merge request gitlab-org/gitlab-ee!4597
Diffstat (limited to 'app/controllers/concerns/uploads_actions.rb')
-rw-r--r--app/controllers/concerns/uploads_actions.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb
index 3dbfabcae8a..f4e19615760 100644
--- a/app/controllers/concerns/uploads_actions.rb
+++ b/app/controllers/concerns/uploads_actions.rb
@@ -62,19 +62,27 @@ module UploadsActions
end
def build_uploader_from_upload
- return nil unless params[:secret] && params[:filename]
+ return unless uploader = build_uploader
- upload_path = uploader_class.upload_path(params[:secret], params[:filename])
- upload = Upload.find_by(uploader: uploader_class.to_s, path: upload_path)
+ upload_paths = uploader.upload_paths(params[:filename])
+ upload = Upload.find_by(uploader: uploader_class.to_s, path: upload_paths)
upload&.build_uploader
end
def build_uploader_from_params
+ return unless uploader = build_uploader
+
+ uploader.retrieve_from_store!(params[:filename])
+ uploader
+ end
+
+ def build_uploader
+ return unless params[:secret] && params[:filename]
+
uploader = uploader_class.new(model, secret: params[:secret])
- return nil unless uploader.model_valid?
+ return unless uploader.model_valid?
- uploader.retrieve_from_store!(params[:filename])
uploader
end