Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
14d95b05
Commit
14d95b05
authored
Nov 20, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Part of tests done [ci skip]
parent
888821f9
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
338 additions
and
104 deletions
+338
-104
lib/gitlab/lfs/response.rb
lib/gitlab/lfs/response.rb
+16
-11
spec/lib/gitlab/lfs/lfs_router_spec.rb
spec/lib/gitlab/lfs/lfs_router_spec.rb
+322
-93
No files found.
lib/gitlab/lfs/response.rb
View file @
14d95b05
...
@@ -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
[
'
_link
s'
]
=
{
object
[
'
action
s'
]
=
{
'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'
=>
{
...
...
spec/lib/gitlab/lfs/lfs_router_spec.rb
View file @
14d95b05
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment