-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
params do
build_with Grape::Extensions::Hash::ParamBuilder
requires :avatar, type: File
end
post '/' do
...
end
Returns an error #<Grape::Exceptions::ValidationErrors: avatar is invalid>
because:
- This line calls
deep_dup
of hash values ( including tempfile)
grape/lib/grape/extensions/hash.rb
Line 14 in 0f57e01
rack_params.deep_dup.tap do |params| Tempfile#deep_dup
returns instance ofFile
grape/lib/grape/validations/types/file.rb
Line 25 in 0f57e01
value.is_a?(::Hash) && value.key?(:tempfile) && value[:tempfile].is_a?(Tempfile)