summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-01-14 14:23:42 +0100
committerRémy Coutable <remy@rymai.me>2016-01-14 14:23:42 +0100
commit1b08cd811abeed18c3601e1b997b0566a243662c (patch)
tree1b8f624b29bd2ae77d9344e31a3afe99f7b14536 /lib/api/helpers.rb
parentc31d777c8f24029d7e11dd1e78eddf0c0b6e6f01 (diff)
parente47f0e563d127f593f16c0a521c836e21bceb77f (diff)
downloadgitlab-ce-1b08cd811abeed18c3601e1b997b0566a243662c.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into add-pagination-headers-to-api
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 312ef90915f..6d2380cf47d 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -287,12 +287,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)