Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test multipart upload with a semicolon in the name.

Test a multipart upload in which the specified
filename includes a semicolon. Should be parsed
with the included filename, but Rack stops at the
filename.

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information...
commit 354073d9a2071fa58e18d471bb6bd70dd171face 1 parent 38f205e
Daniel Rodríguez Troitiño drodriguez authored chneukirchen committed
Showing with 18 additions and 0 deletions.
  1. +6 −0 test/multipart/semicolon
  2. +12 −0 test/spec_rack_utils.rb
6 test/multipart/semicolon
View
@@ -0,0 +1,6 @@
+--AaB03x
+Content-Disposition: form-data; name="files"; filename="fi;le1.txt"
+Content-Type: text/plain
+
+contents
+--AaB03x--
12 test/spec_rack_utils.rb
View
@@ -383,6 +383,18 @@ def context env, app=@app; app.call(env); end
params["files"][:tempfile].read.should.equal ""
end
+ specify "should parse multipart upload with filename with semicolons" do
+ env = Rack::MockRequest.env_for("/", multipart_fixture(:semicolon))
+ params = Rack::Utils::Multipart.parse_multipart(env)
+ params["files"][:type].should.equal "text/plain"
+ params["files"][:filename].should.equal "fi;le1.txt"
+ params["files"][:head].should.equal "Content-Disposition: form-data; " +
+ "name=\"files\"; filename=\"fi;le1.txt\"\r\n" +
+ "Content-Type: text/plain\r\n"
+ params["files"][:name].should.equal "files"
+ params["files"][:tempfile].read.should.equal "contents"
+ end
+
specify "should not include file params if no file was selected" do
env = Rack::MockRequest.env_for("/", multipart_fixture(:none))
params = Rack::Utils::Multipart.parse_multipart(env)
Please sign in to comment.
Something went wrong with that request. Please try again.