summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-04-11 17:45:22 +0200
committerAndreas Brandl <abrandl@gitlab.com>2018-04-13 15:59:45 +0200
commitc4e4258721ae08718a69d73e5046119e4db2f5ef (patch)
tree6669e7c658fd30d06a14a31bee9b4bd849e402b6 /lib/api/helpers.rb
parentab98308db7d907e5fad53d2b1e3435960a1665cd (diff)
downloadgitlab-ce-c4e4258721ae08718a69d73e5046119e4db2f5ef.tar.gz
Validate project path prior to hitting the database.
Closes #45247.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb4
1 files changed, 2 insertions, 2 deletions
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