diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-03 18:47:33 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-05 15:01:14 +0200 |
commit | 678620cce67cc283b19b75137f747f9415aaf942 (patch) | |
tree | 650b53c790087b88ce40f79c7c66cef6994c25b4 /app/controllers/projects/lfs_storage_controller.rb | |
parent | 9b1677b2deeec1faf0dd1d60a2b0c47e80b58433 (diff) | |
download | gitlab-ce-678620cce67cc283b19b75137f747f9415aaf942.tar.gz |
Add `direct_upload` setting for artifactsdirect-upload-of-artifacts
Diffstat (limited to 'app/controllers/projects/lfs_storage_controller.rb')
-rw-r--r-- | app/controllers/projects/lfs_storage_controller.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/projects/lfs_storage_controller.rb b/app/controllers/projects/lfs_storage_controller.rb index 2515e4b9a17..ebde0df1f7b 100644 --- a/app/controllers/projects/lfs_storage_controller.rb +++ b/app/controllers/projects/lfs_storage_controller.rb @@ -31,7 +31,9 @@ class Projects::LfsStorageController < Projects::GitHttpClientController render plain: 'Unprocessable entity', status: 422 end rescue ActiveRecord::RecordInvalid - render_400 + render_lfs_forbidden + rescue UploadedFile::InvalidPathError + render_lfs_forbidden rescue ObjectStorage::RemoteStoreError render_lfs_forbidden end @@ -66,10 +68,11 @@ class Projects::LfsStorageController < Projects::GitHttpClientController end def create_file!(oid, size) - LfsObject.new(oid: oid, size: size).tap do |object| - object.file.store_workhorse_file!(params, :file) - object.save! - end + uploaded_file = UploadedFile.from_params( + params, :file, LfsObjectUploader.workhorse_local_upload_path) + return unless uploaded_file + + LfsObject.create!(oid: oid, size: size, file: uploaded_file) end def link_to_project!(object) |