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
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-12-31 06:23:50 +0300
committerHeinrich Lee Yu <hleeyu@gmail.com>2019-01-07 06:16:58 +0300
commit63e9969ca3ac57839b78d9cc44bcf32bc9a45248 (patch)
treecda51e40b5ea915d26425edfce815ca6fae991e9 /lib
parentccbc45559b7bedd1d76c1840bbdfba3cce542af7 (diff)
Refactor upload service to return uploader
Also changes old calls to the service
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb2
-rw-r--r--lib/gitlab/email/attachment_uploader.rb2
-rw-r--r--lib/gitlab/import_export/uploads_manager.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index f5d21d8923f..9f3a1699146 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -475,7 +475,7 @@ module API
requires :file, type: File, desc: 'The file to be uploaded'
end
post ":id/uploads" do
- UploadService.new(user_project, params[:file]).execute
+ UploadService.new(user_project, params[:file]).execute.to_h
end
desc 'Get the users list of a project' do
diff --git a/lib/gitlab/email/attachment_uploader.rb b/lib/gitlab/email/attachment_uploader.rb
index a826519b2dd..bffea697f9a 100644
--- a/lib/gitlab/email/attachment_uploader.rb
+++ b/lib/gitlab/email/attachment_uploader.rb
@@ -23,7 +23,7 @@ module Gitlab
content_type: attachment.content_type
}
- link = UploadService.new(project, file).execute
+ link = UploadService.new(project, file).execute.to_h
attachments << link if link
ensure
tmp.close!
diff --git a/lib/gitlab/import_export/uploads_manager.rb b/lib/gitlab/import_export/uploads_manager.rb
index 474e9d45566..e232198150a 100644
--- a/lib/gitlab/import_export/uploads_manager.rb
+++ b/lib/gitlab/import_export/uploads_manager.rb
@@ -40,7 +40,7 @@ module Gitlab
def add_upload(upload)
uploader_context = FileUploader.extract_dynamic_path(upload).named_captures.symbolize_keys
- UploadService.new(@project, File.open(upload, 'r'), FileUploader, uploader_context).execute
+ UploadService.new(@project, File.open(upload, 'r'), FileUploader, uploader_context).execute.to_h
end
def copy_project_uploads