diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-13 14:02:36 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:17 +0100 |
commit | 154b8ceba4ac2d92a2387ad50d7f2b4ed5b2dd8a (patch) | |
tree | 795172bfd14ab647cd504b9cec67bb95608242a9 /lib/api/helpers.rb | |
parent | 3f0c18f80e36561581ef6fa6dbfcec169e1a6e08 (diff) | |
download | gitlab-ce-154b8ceba4ac2d92a2387ad50d7f2b4ed5b2dd8a.tar.gz |
Refactor build artifacts upload API endpoint
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index a4df810e755..d46b5c42967 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -289,12 +289,14 @@ module API # file helpers - def uploaded_file!(field, uploads_path) + def uploaded_file(field, uploads_path) if params[field] bad_request!("#{field} is not a file") unless params[field].respond_to?(:filename) return params[field] end + return nil unless params["#{field}.path"] && params["#{field}.name"] + # sanitize file paths # this requires all paths to exist required_attributes! %W(#{field}.path) |