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
Léo-Paul Géneau
gitlab-ce
Commits
1bbcc296
Commit
1bbcc296
authored
Sep 17, 2015
by
Francesco Levorato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect case sensitive project path to the normalized one
parent
6bff207d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+6
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+6
-0
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+14
-0
No files found.
app/controllers/application_controller.rb
View file @
1bbcc296
...
...
@@ -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
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
1bbcc296
...
...
@@ -17,6 +17,12 @@ describe Projects::IssuesController do
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
...
...
spec/controllers/projects_controller_spec.rb
View file @
1bbcc296
...
...
@@ -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
...
...
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