Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
71952d05
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
71952d05
编写于
7月 22, 2016
作者:
J
Jacob Vosmaer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Handle custom Git LFS content type
上级
23425401
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
5 deletion
+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
未找到文件。
config/initializers/mime_types.rb
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录