From c4e4258721ae08718a69d73e5046119e4db2f5ef Mon Sep 17 00:00:00 2001 From: Andreas Brandl Date: Wed, 11 Apr 2018 17:45:22 +0200 Subject: Validate project path prior to hitting the database. Closes #45247. --- lib/api/helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 61dab1dd5cb..b8657cd7ee4 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -103,9 +103,9 @@ module API end def find_project(id) - if id =~ /^\d+$/ + if id.is_a?(Integer) || id =~ /^\d+$/ Project.find_by(id: id) - else + elsif id.include?("/") Project.find_by_full_path(id) end end -- cgit v1.2.1