aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorKohei Suzuki <eagletmt@gmail.com>2015-08-04 21:26:28 +0900
committerKohei Suzuki <eagletmt@gmail.com>2015-08-04 21:27:22 +0900
commitb5ae1be2cd1aef2f6ed7a53a4684c6b7eb35304f (patch)
treed894a76c2191d5a53b0d706023f7db53f9d63def /actionpack/test
parent7a3ca69959e312a215d5e8144fca79a08654fd89 (diff)
downloadrails-b5ae1be2cd1aef2f6ed7a53a4684c6b7eb35304f.tar.gz
rails-b5ae1be2cd1aef2f6ed7a53a4684c6b7eb35304f.tar.bz2
rails-b5ae1be2cd1aef2f6ed7a53a4684c6b7eb35304f.zip
Add failing spec on utf8 filename with percent character
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/request/multipart_params_parsing_test.rb11
-rw-r--r--actionpack/test/fixtures/multipart/utf8_filename10
2 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/multipart_params_parsing_test.rb b/actionpack/test/dispatch/request/multipart_params_parsing_test.rb
index 939a771c65..b36fbd3c76 100644
--- a/actionpack/test/dispatch/request/multipart_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/multipart_params_parsing_test.rb
@@ -63,6 +63,17 @@ class MultipartParamsParsingTest < ActionDispatch::IntegrationTest
assert_equal 'contents', file.read
end
+ test "parses utf8 filename with percent character" do
+ params = parse_multipart('utf8_filename')
+ assert_equal %w(file foo), params.keys.sort
+ assert_equal 'bar', params['foo']
+
+ file = params['file']
+ assert_equal 'ファイル%名.txt', file.original_filename
+ assert_equal "text/plain", file.content_type
+ assert_equal 'contents', file.read
+ end
+
test "parses boundary problem file" do
params = parse_multipart('boundary_problem_file')
assert_equal %w(file foo), params.keys.sort
diff --git a/actionpack/test/fixtures/multipart/utf8_filename b/actionpack/test/fixtures/multipart/utf8_filename
new file mode 100644
index 0000000000..60738d53b0
--- /dev/null
+++ b/actionpack/test/fixtures/multipart/utf8_filename
@@ -0,0 +1,10 @@
+--AaB03x
+Content-Disposition: form-data; name="foo"
+
+bar
+--AaB03x
+Content-Disposition: form-data; name="file"; filename="ファイル%名.txt"
+Content-Type: text/plain
+
+contents
+--AaB03x--