aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/request
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2017-07-14 15:02:30 -0400
committerArthur Neves <arthurnn@gmail.com>2017-07-17 13:07:59 -0400
commit2513a410f56413031738084b16aa9565e251ff66 (patch)
tree8e5e0757742e66c8a26ccf9a6bf81fa1ce09a36b /actionpack/lib/action_dispatch/request
parentc1f9fa8c69590222fac43d58bf64ef4a1225d7ce (diff)
downloadrails-2513a410f56413031738084b16aa9565e251ff66.tar.gz
rails-2513a410f56413031738084b16aa9565e251ff66.tar.bz2
rails-2513a410f56413031738084b16aa9565e251ff66.zip
Scrub the invalid paramter value before using it in the error
You should be able to safely use the String error message. So when finding the paramter has an invalid encoding we need to remove the invalid bytes before using it in the error. Otherwise the caller might get another Encoding error if they use the message.
Diffstat (limited to 'actionpack/lib/action_dispatch/request')
-rw-r--r--actionpack/lib/action_dispatch/request/utils.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/request/utils.rb b/actionpack/lib/action_dispatch/request/utils.rb
index 4f79c4c21e..daac68d4b4 100644
--- a/actionpack/lib/action_dispatch/request/utils.rb
+++ b/actionpack/lib/action_dispatch/request/utils.rb
@@ -32,7 +32,7 @@ module ActionDispatch
unless params.valid_encoding?
# Raise Rack::Utils::InvalidParameterError for consistency with Rack.
# ActionDispatch::Request#GET will re-raise as a BadRequest error.
- raise Rack::Utils::InvalidParameterError, "Non UTF-8 value: #{params}"
+ raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
end
end
end