diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-16 11:18:39 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-16 11:18:39 +0000 |
commit | 4fcee58636259e523a0e1b85e2090160a3938496 (patch) | |
tree | 02c6031f12ab2129fdd0e7686a6541b9c4a66cef /lib | |
parent | 218b55dec9b0bc8926ded62a4f046fbea2c78cf3 (diff) | |
parent | c4e4258721ae08718a69d73e5046119e4db2f5ef (diff) | |
download | gitlab-ce-4fcee58636259e523a0e1b85e2090160a3938496.tar.gz |
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 |