From 2f7fc7e9f7e7a43914abe81a510bd0dffa113979 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Tue, 20 Oct 2015 16:16:08 +0200 Subject: Prefer project with exact path to differently cased one when both exist. --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f0124c6bd60..38e6b44eb6f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -118,8 +118,8 @@ class ApplicationController < ActionController::Base end project_path = "#{namespace}/#{id}" - @project = Project.find_with_namespace(project_path) - + @project = Project.find_with_namespace(project_path) || + Project.find_with_namespace(project_path, case_sensitive: false) if @project and can?(current_user, :read_project, @project) if @project.path_with_namespace != project_path -- cgit v1.2.1 From e17e5a5ce462022761d3cdc29d677f968ca9738a Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 21 Oct 2015 10:09:32 +0200 Subject: Move case sensitivity check to find_with_namespace. --- app/controllers/application_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 38e6b44eb6f..1a47a3c0ee3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -118,8 +118,7 @@ class ApplicationController < ActionController::Base end project_path = "#{namespace}/#{id}" - @project = Project.find_with_namespace(project_path) || - Project.find_with_namespace(project_path, case_sensitive: false) + @project = Project.find_with_namespace(project_path) if @project and can?(current_user, :read_project, @project) if @project.path_with_namespace != project_path -- cgit v1.2.1