summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/project-url-constrainer-select.yml4
-rw-r--r--lib/constraints/project_url_constrainer.rb3
2 files changed, 6 insertions, 1 deletions
diff --git a/changelogs/unreleased/project-url-constrainer-select.yml b/changelogs/unreleased/project-url-constrainer-select.yml
new file mode 100644
index 00000000000..6d4fc98cac7
--- /dev/null
+++ b/changelogs/unreleased/project-url-constrainer-select.yml
@@ -0,0 +1,4 @@
+---
+title: Don't SELECT * just to check if a project exists
+merge_request:
+author:
diff --git a/lib/constraints/project_url_constrainer.rb b/lib/constraints/project_url_constrainer.rb
index 4c0aee6c48f..7b3cab11df1 100644
--- a/lib/constraints/project_url_constrainer.rb
+++ b/lib/constraints/project_url_constrainer.rb
@@ -6,6 +6,7 @@ class ProjectUrlConstrainer
return false unless DynamicPathValidator.valid_project_path?(full_path)
- Project.find_by_full_path(full_path, follow_redirects: request.get?).present?
+ Project.select(1)
+ .find_by_full_path(full_path, follow_redirects: request.get?).present?
end
end