summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-10-22 13:03:04 +0000
committerRobert Speicher <robert@gitlab.com>2015-10-22 13:03:04 +0000
commit7924dd5c9f5d55daaa49132844e71d28169d0e20 (patch)
tree09b09ba4e2948662f4250714e4734aaaf9b20201 /app/models/project.rb
parentb97977afef26e8aaad9228c8c7dffecdbe1a8e59 (diff)
parent98f982f91d6e2d6ec1b59ea5645d8320989e2de6 (diff)
downloadgitlab-ce-7924dd5c9f5d55daaa49132844e71d28169d0e20.tar.gz
Merge branch 'project-path-case-sensitivity' into 'master'
Prefer project with exact path to differently cased one when both exist. Fixes #3113. See merge request !1649
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4c5bf220f24..74b89aad499 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -243,11 +243,12 @@ class Project < ActiveRecord::Base
# Use of unscoped ensures we're not secretly adding any ORDER BYs, which
# have a negative impact on performance (and aren't needed for this
# query).
- unscoped.
+ projects = unscoped.
joins(:namespace).
- iwhere('namespaces.path' => namespace_path).
- iwhere('projects.path' => project_path).
- take
+ iwhere('namespaces.path' => namespace_path)
+
+ projects.where('projects.path' => project_path).take ||
+ projects.iwhere('projects.path' => project_path).take
end
def visibility_levels