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
iv
gitlab-ce
Commits
fc4f5eef
Commit
fc4f5eef
authored
Oct 01, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'flevour/gitlab-ce-project-path-insensitive-lookup'
parents
1ca11993
7c7b664c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
7 deletions
+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
No files found.
CHANGELOG
View file @
fc4f5eef
...
@@ -102,6 +102,7 @@ v 8.0.0
...
@@ -102,6 +102,7 @@ v 8.0.0
- Webhook for issue now contains repository field (Jungkook Park)
- Webhook for issue now contains repository field (Jungkook Park)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add pg_schema to backup config
- 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
- Removed API calls from CE to CI
v 7.14.3
v 7.14.3
...
...
app/controllers/application_controller.rb
View file @
fc4f5eef
...
@@ -117,9 +117,14 @@ class ApplicationController < ActionController::Base
...
@@ -117,9 +117,14 @@ class ApplicationController < ActionController::Base
redirect_to
request
.
original_url
.
gsub
(
/\.git\Z/
,
''
)
and
return
redirect_to
request
.
original_url
.
gsub
(
/\.git\Z/
,
''
)
and
return
end
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
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
@project
elsif
current_user
.
nil?
elsif
current_user
.
nil?
@project
=
nil
@project
=
nil
...
...
app/models/project.rb
View file @
fc4f5eef
...
@@ -238,10 +238,10 @@ class Project < ActiveRecord::Base
...
@@ -238,10 +238,10 @@ class Project < ActiveRecord::Base
return
nil
unless
id
.
include?
(
'/'
)
return
nil
unless
id
.
include?
(
'/'
)
id
=
id
.
split
(
'/'
)
id
=
id
.
split
(
'/'
)
namespace
=
Namespace
.
find_by
(
path:
id
.
first
)
namespace
=
Namespace
.
by_path
(
id
.
first
)
return
nil
unless
namespace
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
end
def
visibility_levels
def
visibility_levels
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
fc4f5eef
...
@@ -8,28 +8,34 @@ describe Projects::IssuesController do
...
@@ -8,28 +8,34 @@ describe Projects::IssuesController do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
controller
.
instance_variable_set
(
:@project
,
project
)
end
end
describe
"GET #index"
do
describe
"GET #index"
do
it
"returns 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
)
expect
(
response
.
status
).
to
eq
(
200
)
end
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
it
"returns 404 when issues are disabled"
do
project
.
issues_enabled
=
false
project
.
issues_enabled
=
false
project
.
save
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
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
it
"returns 404 when external issue tracker is enabled"
do
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
)
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
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
...
...
spec/controllers/projects_controller_spec.rb
View file @
fc4f5eef
...
@@ -21,6 +21,20 @@ describe ProjectsController do
...
@@ -21,6 +21,20 @@ describe ProjectsController do
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
end
end
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
end
describe
"POST #toggle_star"
do
describe
"POST #toggle_star"
do
...
...
spec/models/project_spec.rb
View file @
fc4f5eef
...
@@ -220,6 +220,7 @@ describe Project do
...
@@ -220,6 +220,7 @@ describe Project do
end
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/GitlabHQ'
)).
to
eq
(
@project
)
}
it
{
expect
(
Project
.
find_with_namespace
(
'gitlab-ci'
)).
to
be_nil
}
it
{
expect
(
Project
.
find_with_namespace
(
'gitlab-ci'
)).
to
be_nil
}
end
end
end
end
...
...
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