Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
fc4f5eef
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,发现更多精彩内容 >>
提交
fc4f5eef
编写于
10月 01, 2015
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'flevour/gitlab-ce-project-path-insensitive-lookup'
上级
1ca11993
7c7b664c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
34 addition
and
7 deletion
+34
-7
CHANGELOG
CHANGELOG
+1
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+6
-1
app/models/project.rb
app/models/project.rb
+2
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+10
-4
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+14
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-0
未找到文件。
CHANGELOG
浏览文件 @
fc4f5eef
...
...
@@ -102,6 +102,7 @@ v 8.0.0
- Webhook for issue now contains repository field (Jungkook Park)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add pg_schema to backup config
- Redirect from incorrectly cased group or project path to correct one (Francesco Levorato)
- Removed API calls from CE to CI
v 7.14.3
...
...
app/controllers/application_controller.rb
浏览文件 @
fc4f5eef
...
...
@@ -117,9 +117,14 @@ class ApplicationController < ActionController::Base
redirect_to
request
.
original_url
.
gsub
(
/\.git\Z/
,
''
)
and
return
end
@project
=
Project
.
find_with_namespace
(
"
#{
namespace
}
/
#{
id
}
"
)
project_path
=
"
#{
namespace
}
/
#{
id
}
"
@project
=
Project
.
find_with_namespace
(
project_path
)
if
@project
and
can?
(
current_user
,
:read_project
,
@project
)
if
@project
.
path_with_namespace
!=
project_path
redirect_to
request
.
original_url
.
gsub
(
project_path
,
@project
.
path_with_namespace
)
and
return
end
@project
elsif
current_user
.
nil?
@project
=
nil
...
...
app/models/project.rb
浏览文件 @
fc4f5eef
...
...
@@ -238,10 +238,10 @@ class Project < ActiveRecord::Base
return
nil
unless
id
.
include?
(
'/'
)
id
=
id
.
split
(
'/'
)
namespace
=
Namespace
.
find_by
(
path:
id
.
first
)
namespace
=
Namespace
.
by_path
(
id
.
first
)
return
nil
unless
namespace
where
(
namespace_id:
namespace
.
id
).
find_by
(
path:
id
.
second
)
where
(
namespace_id:
namespace
.
id
).
where
(
"LOWER(projects.path) = :path"
,
path:
id
.
second
.
downcase
).
first
end
def
visibility_levels
...
...
spec/controllers/projects/issues_controller_spec.rb
浏览文件 @
fc4f5eef
...
...
@@ -8,28 +8,34 @@ describe Projects::IssuesController do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
controller
.
instance_variable_set
(
:@project
,
project
)
end
describe
"GET #index"
do
it
"returns index"
do
get
:index
,
namespace_id:
project
.
namespace
.
id
,
project_id:
project
.
id
get
:index
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
expect
(
response
.
status
).
to
eq
(
200
)
end
it
"return 301 if request path doesn't match project path"
do
get
:index
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
.
upcase
expect
(
response
).
to
redirect_to
(
namespace_project_issues_path
(
project
.
namespace
,
project
))
end
it
"returns 404 when issues are disabled"
do
project
.
issues_enabled
=
false
project
.
save
get
:index
,
namespace_id:
project
.
namespace
.
id
,
project_id:
project
.
id
get
:index
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
expect
(
response
.
status
).
to
eq
(
404
)
end
it
"returns 404 when external issue tracker is enabled"
do
controller
.
instance_variable_set
(
:@project
,
project
)
allow
(
project
).
to
receive
(
:default_issues_tracker?
).
and_return
(
false
)
get
:index
,
namespace_id:
project
.
namespace
.
id
,
project_id:
project
.
id
get
:index
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
expect
(
response
.
status
).
to
eq
(
404
)
end
...
...
spec/controllers/projects_controller_spec.rb
浏览文件 @
fc4f5eef
...
...
@@ -21,6 +21,20 @@ describe ProjectsController do
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
end
end
context
"when requested with case sensitive namespace and project path"
do
it
"redirects to the normalized path for case mismatch"
do
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
.
upcase
expect
(
response
).
to
redirect_to
(
"/
#{
public_project
.
path_with_namespace
}
"
)
end
it
"loads the page if normalized path matches request path"
do
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
expect
(
response
.
status
).
to
eq
(
200
)
end
end
end
describe
"POST #toggle_star"
do
...
...
spec/models/project_spec.rb
浏览文件 @
fc4f5eef
...
...
@@ -220,6 +220,7 @@ describe Project do
end
it
{
expect
(
Project
.
find_with_namespace
(
'gitlab/gitlabhq'
)).
to
eq
(
@project
)
}
it
{
expect
(
Project
.
find_with_namespace
(
'GitLab/GitlabHQ'
)).
to
eq
(
@project
)
}
it
{
expect
(
Project
.
find_with_namespace
(
'gitlab-ci'
)).
to
be_nil
}
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录