Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d17f89f3
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 搜索 >>
提交
d17f89f3
编写于
9月 10, 2019
作者:
J
Jesse Hall
提交者:
Nick Thomas
9月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start of fix for #21859, allow users to open files with newlines in the filenames.
上级
5975f55c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
67 addition
and
5 deletion
+67
-5
config/routes/repository.rb
config/routes/repository.rb
+1
-1
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+66
-4
未找到文件。
config/routes/repository.rb
浏览文件 @
d17f89f3
...
...
@@ -65,7 +65,7 @@ scope format: false do
resources
:protected_tags
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
]
end
scope
constraints:
{
id:
/
.
+/
}
do
scope
constraints:
{
id:
/
[^\0]
+/
}
do
scope
controller: :blob
do
get
'/new/*id'
,
action: :new
,
as: :new_blob
post
'/create/*id'
,
action: :create
,
as: :create_blob
...
...
spec/routing/project_routing_spec.rb
浏览文件 @
d17f89f3
...
...
@@ -530,15 +530,22 @@ describe 'project routing' do
end
end
# project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /
.
+/, project_id: /[^\/]+/}
# project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /
[^\0]
+/, project_id: /[^\/]+/}
describe
Projects
::
BlameController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/blame/master/app/models/project.rb'
)).
to
route_to
(
'projects/blame#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
expect
(
get
(
'/gitlab/gitlabhq/blame/master/files.scss'
)).
to
route_to
(
'projects/blame#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/files.scss'
)
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/blame/master/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/blame'
,
action:
'show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"master/
#{
newline_file
}
"
})
end
end
# project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /
.
+/, project_id: /[^\/]+/}
# project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /
[^\0]
+/, project_id: /[^\/]+/}
describe
Projects
::
BlobController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/blob/master/app/models/project.rb'
)).
to
route_to
(
'projects/blob#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
...
...
@@ -547,28 +554,56 @@ describe 'project routing' do
expect
(
get
(
'/gitlab/gitlabhq/blob/master/files.scss'
)).
to
route_to
(
'projects/blob#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/files.scss'
)
expect
(
get
(
'/gitlab/gitlabhq/blob/master/blob/index.js'
)).
to
route_to
(
'projects/blob#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/blob/index.js'
)
expect
(
get
(
'/gitlab/gitlabhq/blob/blob/master/blob/index.js'
)).
to
route_to
(
'projects/blob#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'blob/master/blob/index.js'
)
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/blob/blob/master/blob/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/blob'
,
action:
'show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"blob/master/blob/
#{
newline_file
}
"
})
end
end
# project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /
.
+/, project_id: /[^\/]+/}
# project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /
[^\0]
+/, project_id: /[^\/]+/}
describe
Projects
::
TreeController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/tree/master/app/models/project.rb'
)).
to
route_to
(
'projects/tree#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
expect
(
get
(
'/gitlab/gitlabhq/tree/master/files.scss'
)).
to
route_to
(
'projects/tree#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/files.scss'
)
expect
(
get
(
'/gitlab/gitlabhq/tree/master/tree/files'
)).
to
route_to
(
'projects/tree#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/tree/files'
)
expect
(
get
(
'/gitlab/gitlabhq/tree/tree/master/tree/files'
)).
to
route_to
(
'projects/tree#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'tree/master/tree/files'
)
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/tree/master/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/tree'
,
action:
'show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"master/
#{
newline_file
}
"
})
end
end
# project_find_file GET /:namespace_id/:project_id/find_file/*id(.:format) projects/find_file#show {:id=>/
.
+/, :namespace_id=>/[a-zA-Z.0-9_\-]+/, :project_id=>/[a-zA-Z.0-9_\-]+(?<!\.atom)/, :format=>/html/}
# project_find_file GET /:namespace_id/:project_id/find_file/*id(.:format) projects/find_file#show {:id=>/
[^\0]
+/, :namespace_id=>/[a-zA-Z.0-9_\-]+/, :project_id=>/[a-zA-Z.0-9_\-]+(?<!\.atom)/, :format=>/html/}
# project_files GET /:namespace_id/:project_id/files/*id(.:format) projects/find_file#list {:id=>/(?:[^.]|\.(?!json$))+/, :namespace_id=>/[a-zA-Z.0-9_\-]+/, :project_id=>/[a-zA-Z.0-9_\-]+(?<!\.atom)/, :format=>/json/}
describe
Projects
::
FindFileController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/find_file/master'
)).
to
route_to
(
'projects/find_file#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
)
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/find_file/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/find_file'
,
action:
'show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"
#{
newline_file
}
"
})
end
it
'to #list'
do
expect
(
get
(
'/gitlab/gitlabhq/files/master.json'
)).
to
route_to
(
'projects/find_file#list'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master.json'
)
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/files/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/find_file'
,
action:
'list'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"
#{
newline_file
}
"
})
end
end
...
...
@@ -578,6 +613,13 @@ describe 'project routing' do
route_to
(
'projects/blob#edit'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
))
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/edit/master/docs/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/blob'
,
action:
'edit'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"master/docs/
#{
newline_file
}
"
})
end
it
'to #preview'
do
...
...
@@ -585,6 +627,26 @@ describe 'project routing' do
route_to
(
'projects/blob#preview'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
))
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/edit/master/docs/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/blob'
,
action:
'edit'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"master/docs/
#{
newline_file
}
"
})
end
end
# project_raw GET /:project_id/raw/:id(.:format) raw#show {id: /[^\0]+/, project_id: /[^\/]+/}
describe
Projects
::
RawController
,
'routing'
do
it
'to #show'
do
newline_file
=
"new
\n\n
line.txt"
url_encoded_newline_file
=
ERB
::
Util
.
url_encode
(
newline_file
)
assert_routing
({
path:
"/gitlab/gitlabhq/raw/master/
#{
url_encoded_newline_file
}
"
,
method: :get
},
{
controller:
'projects/raw'
,
action:
'show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
"master/
#{
newline_file
}
"
})
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录