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
Tatuya Kamada
gitlab-ce
Commits
71952d05
Commit
71952d05
authored
Jul 22, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle custom Git LFS content type
parent
23425401
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
config/initializers/mime_types.rb
config/initializers/mime_types.rb
+7
-0
spec/requests/lfs_http_spec.rb
spec/requests/lfs_http_spec.rb
+5
-5
No files found.
config/initializers/mime_types.rb
View file @
71952d05
...
@@ -12,3 +12,10 @@ Mime::Type.register_alias "text/html", :md
...
@@ -12,3 +12,10 @@ Mime::Type.register_alias "text/html", :md
Mime
::
Type
.
register
"video/mp4"
,
:mp4
,
[],
[
:m4v
,
:mov
]
Mime
::
Type
.
register
"video/mp4"
,
:mp4
,
[],
[
:m4v
,
:mov
]
Mime
::
Type
.
register
"video/webm"
,
:webm
Mime
::
Type
.
register
"video/webm"
,
:webm
Mime
::
Type
.
register
"video/ogg"
,
:ogv
Mime
::
Type
.
register
"video/ogg"
,
:ogv
middlewares
=
Gitlab
::
Application
.
config
.
middleware
middlewares
.
swap
(
ActionDispatch
::
ParamsParser
,
ActionDispatch
::
ParamsParser
,
{
Mime
::
Type
.
lookup
(
'application/vnd.git-lfs+json'
)
=>
lambda
do
|
body
|
ActiveSupport
::
JSON
.
decode
(
body
)
end
})
spec/requests/lfs_http_spec.rb
View file @
71952d05
...
@@ -35,7 +35,7 @@ describe 'Git LFS API and storage' do
...
@@ -35,7 +35,7 @@ describe 'Git LFS API and storage' do
before
do
before
do
allow
(
Gitlab
.
config
.
lfs
).
to
receive
(
:enabled
).
and_return
(
false
)
allow
(
Gitlab
.
config
.
lfs
).
to
receive
(
:enabled
).
and_return
(
false
)
post_json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects/batch"
,
body
,
headers
post_
lfs_
json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects/batch"
,
body
,
headers
end
end
it
'responds with 501'
do
it
'responds with 501'
do
...
@@ -74,7 +74,7 @@ describe 'Git LFS API and storage' do
...
@@ -74,7 +74,7 @@ describe 'Git LFS API and storage' do
context
'when handling lfs request using deprecated API'
do
context
'when handling lfs request using deprecated API'
do
let
(
:authorization
)
{
authorize_user
}
let
(
:authorization
)
{
authorize_user
}
before
do
before
do
post_json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects"
,
nil
,
headers
post_
lfs_
json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects"
,
nil
,
headers
end
end
it_behaves_like
'a deprecated'
it_behaves_like
'a deprecated'
...
@@ -164,7 +164,7 @@ describe 'Git LFS API and storage' do
...
@@ -164,7 +164,7 @@ describe 'Git LFS API and storage' do
enable_lfs
enable_lfs
update_lfs_permissions
update_lfs_permissions
update_user_permissions
update_user_permissions
post_json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects/batch"
,
body
,
headers
post_
lfs_
json
"
#{
project
.
http_url_to_repo
}
/info/lfs/objects/batch"
,
body
,
headers
end
end
describe
'download'
do
describe
'download'
do
...
@@ -775,8 +775,8 @@ describe 'Git LFS API and storage' do
...
@@ -775,8 +775,8 @@ describe 'Git LFS API and storage' do
Projects
::
ForkService
.
new
(
project
,
user
,
{}).
execute
Projects
::
ForkService
.
new
(
project
,
user
,
{}).
execute
end
end
def
post_json
(
url
,
body
=
nil
,
headers
=
nil
)
def
post_
lfs_
json
(
url
,
body
=
nil
,
headers
=
nil
)
post
(
url
,
body
.
try
(
:to_json
),
(
headers
||
{}).
merge
(
'Content-Type'
=>
'application/json'
))
post
(
url
,
body
.
try
(
:to_json
),
(
headers
||
{}).
merge
(
'Content-Type'
=>
'application/
vnd.git-lfs+
json'
))
end
end
def
json_response
def
json_response
...
...
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