diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-16 14:18:39 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-04-20 11:53:38 +0300 |
commit | 56fb7aa563901be6854a4f3eb195722605eae70a (patch) | |
tree | 56ffe963b26ddb79bfbb7a8bb56d8ba18cacd2fd /lib | |
parent | 12c4ca218b5213c9497017749c5cc68a2de2d1c3 (diff) |
Merge branch 'ab-45247-project-lookups-validation' into 'master'
Validate project path prior to hitting the database.
Closes #45247
See merge request gitlab-org/gitlab-ce!18322
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 4 |
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 |