aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
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/test
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/test')
-rw-r--r--actionpack/test/dispatch/request_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 899b27b962..61ae99eadc 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -1024,7 +1024,8 @@ class RequestParameters < BaseRequestTest
request.path_parameters = { foo: "\xBE" }
end
- assert_equal "Invalid path parameters: Non UTF-8 value: \xBE", err.message
+ assert_predicate err.message, :valid_encoding?
+ assert_equal "Invalid path parameters: Invalid encoding for parameter: �", err.message
end
test "parameters not accessible after rack parse error of invalid UTF8 character" do