diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-23 19:04:21 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-23 19:04:21 +0000 |
commit | 09af88336df8e659c2d941105d009b342bcc5851 (patch) | |
tree | b7863769b6e59ff7f30f64affc48ab922f97007d /config | |
parent | db396d5b26f4634d505ce7506dd6af64e3b6b017 (diff) | |
parent | f4a2d33a6795b84a3c7c00de0fb8dbfa6100c037 (diff) | |
download | gitlab-ce-09af88336df8e659c2d941105d009b342bcc5851.tar.gz |
Merge branch 'permit-uploadedfile-scalar' into 'master'
Monkey-patch StrongParameters for ::UploadedFile
Closes gitlab-ee#1451
See merge request !8299
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/workhorse_multipart.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/initializers/workhorse_multipart.rb b/config/initializers/workhorse_multipart.rb index 3e2f25c354a..8de7140e3d4 100644 --- a/config/initializers/workhorse_multipart.rb +++ b/config/initializers/workhorse_multipart.rb @@ -1,3 +1,19 @@ Rails.application.configure do |config| config.middleware.use(Gitlab::Middleware::Multipart) end + +module Gitlab + module StrongParameterScalars + GITLAB_PERMITTED_SCALAR_TYPES = [::UploadedFile] + + def permitted_scalar?(value) + super || GITLAB_PERMITTED_SCALAR_TYPES.any? { |type| value.is_a?(type) } + end + end +end + +module ActionController + class Parameters + prepend Gitlab::StrongParameterScalars + end +end |