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:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-11-20 13:59:32 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-11-20 13:59:32 +0300
commit14d95b0529eacb8f42c5184fb71bff3f326d1670 (patch)
tree2555e875fcd6d49336b7924258cfabc392a6e28d /lib/gitlab/lfs
parent888821f9ffb56c6fdf762f28dd42cf3b7226652f (diff)
Part of tests done [ci skip]
Diffstat (limited to 'lib/gitlab/lfs')
-rw-r--r--lib/gitlab/lfs/response.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/gitlab/lfs/response.rb b/lib/gitlab/lfs/response.rb
index ddadc07ebba..0371e1a7107 100644
--- a/lib/gitlab/lfs/response.rb
+++ b/lib/gitlab/lfs/response.rb
@@ -42,7 +42,7 @@ module Gitlab
when "upload"
render_batch_upload(request_body)
else
- render_forbidden
+ render_not_found
end
end
@@ -322,16 +322,21 @@ module Gitlab
def download_hypermedia_links(all_objects, existing_objects)
all_objects.each do |object|
# generate links only for existing objects
- next unless existing_objects.include?(object['oid'])
-
- object['_links'] = {
- 'download' => {
- 'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}",
- 'header' => {
- 'Authorization' => @env['HTTP_AUTHORIZATION']
- }.compact
+ if existing_objects.include?(object['oid'])
+ object['actions'] = {
+ 'download' => {
+ 'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}",
+ 'header' => {
+ 'Authorization' => @env['HTTP_AUTHORIZATION']
+ }.compact
+ }
}
- }
+ else
+ object['error'] = {
+ 'code' => 404,
+ 'message' => "Object does not exist on the server or you don't have permissions to access it",
+ }
+ end
end
{ 'objects' => all_objects }
@@ -342,7 +347,7 @@ module Gitlab
# generate links only for non-existing objects
next if existing_objects.include?(object['oid'])
- object['_links'] = {
+ object['actions'] = {
'upload' => {
'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}/#{object['size']}",
'header' => {