diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2016-12-23 13:42:42 +0100 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2016-12-23 18:28:46 +0100 |
commit | f4a2d33a6795b84a3c7c00de0fb8dbfa6100c037 (patch) | |
tree | c874da378a9500fdd6f194e06dbe883f5b7179ec /config | |
parent | 46920f7e371debe6af526ab9476aef6ca452185b (diff) | |
download | gitlab-ce-f4a2d33a6795b84a3c7c00de0fb8dbfa6100c037.tar.gz |
Monkey-patch StrongParameters for ::UploadedFile
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 |