Commit 7ea48bfb authored by Kamil Trzcinski's avatar Kamil Trzcinski Committed by Marin Jankovski

Part of tests done [ci skip]

parent 28113478
...@@ -42,7 +42,7 @@ module Gitlab ...@@ -42,7 +42,7 @@ module Gitlab
when "upload" when "upload"
render_batch_upload(request_body) render_batch_upload(request_body)
else else
render_forbidden render_not_found
end end
end end
...@@ -322,16 +322,21 @@ module Gitlab ...@@ -322,16 +322,21 @@ module Gitlab
def download_hypermedia_links(all_objects, existing_objects) def download_hypermedia_links(all_objects, existing_objects)
all_objects.each do |object| all_objects.each do |object|
# generate links only for existing objects # generate links only for existing objects
next unless existing_objects.include?(object['oid']) if existing_objects.include?(object['oid'])
object['actions'] = {
object['_links'] = { 'download' => {
'download' => { 'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}",
'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}", 'header' => {
'header' => { 'Authorization' => @env['HTTP_AUTHORIZATION']
'Authorization' => @env['HTTP_AUTHORIZATION'] }.compact
}.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 end
{ 'objects' => all_objects } { 'objects' => all_objects }
...@@ -342,7 +347,7 @@ module Gitlab ...@@ -342,7 +347,7 @@ module Gitlab
# generate links only for non-existing objects # generate links only for non-existing objects
next if existing_objects.include?(object['oid']) next if existing_objects.include?(object['oid'])
object['_links'] = { object['actions'] = {
'upload' => { 'upload' => {
'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}/#{object['size']}", 'href' => "#{@origin_project.http_url_to_repo}/gitlab-lfs/objects/#{object['oid']}/#{object['size']}",
'header' => { 'header' => {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment