summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorFrancesco Levorato <git@flevour.net>2015-09-17 15:56:16 +0200
committerFrancesco Levorato <git@flevour.net>2015-09-18 16:37:21 +0200
commit1bbcc29687e9d5cef52e630f1e85d4c9f81fca07 (patch)
tree5131f9d534a624e5a60e48eca91bcb98b8f68d08 /app/controllers/application_controller.rb
parent6bff207dfdb37618f0f4291abf40d25127836dfe (diff)
downloadgitlab-ce-1bbcc29687e9d5cef52e630f1e85d4c9f81fca07.tar.gz
Redirect case sensitive project path to the normalized one
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9b6472a7b13..527c9da0faa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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