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/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 18:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 18:09:13 +0300
commit736d36d8597d0d1ec1b47644e6d091c3f4a78f45 (patch)
treea38f6fef2b7147416b31f8294a9389b3bb472c87 /lib/api
parent5426ca9908085087d465fa52800335f408eb965a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities/project_upload.rb21
-rw-r--r--lib/api/projects.rb4
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/api/entities/project_upload.rb b/lib/api/entities/project_upload.rb
new file mode 100644
index 00000000000..f38f8d74f7b
--- /dev/null
+++ b/lib/api/entities/project_upload.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module API
+ module Entities
+ class ProjectUpload < Grape::Entity
+ include Gitlab::Routing
+
+ expose :markdown_name, as: :alt
+ expose :secure_url, as: :url
+ expose :full_path do |uploader|
+ show_project_uploads_path(
+ uploader.model,
+ uploader.secret,
+ uploader.filename
+ )
+ end
+
+ expose :markdown_link, as: :markdown
+ end
+ end
+end
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 6f96ffde0a7..43d607bc0c1 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -494,7 +494,9 @@ module API
requires :file, type: File, desc: 'The file to be uploaded' # rubocop:disable Scalability/FileUploads
end
post ":id/uploads" do
- UploadService.new(user_project, params[:file]).execute.to_h
+ upload = UploadService.new(user_project, params[:file]).execute
+
+ present upload, with: Entities::ProjectUpload
end
desc 'Get the users list of a project' do