Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 2 changed files with 18 additions and 0 deletions. Show diff stats Hide diff stats

  1. +6 0 test/multipart/semicolon
  2. +12 0 test/spec_rack_utils.rb
6 test/multipart/semicolon
... ... @@ -0,0 +1,6 @@
  1 +--AaB03x
  2 +Content-Disposition: form-data; name="files"; filename="fi;le1.txt"
  3 +Content-Type: text/plain
  4 +
  5 +contents
  6 +--AaB03x--
12 test/spec_rack_utils.rb
@@ -383,6 +383,18 @@ def context env, app=@app; app.call(env); end
383 383 params["files"][:tempfile].read.should.equal ""
384 384 end
385 385
  386 + specify "should parse multipart upload with filename with semicolons" do
  387 + env = Rack::MockRequest.env_for("/", multipart_fixture(:semicolon))
  388 + params = Rack::Utils::Multipart.parse_multipart(env)
  389 + params["files"][:type].should.equal "text/plain"
  390 + params["files"][:filename].should.equal "fi;le1.txt"
  391 + params["files"][:head].should.equal "Content-Disposition: form-data; " +
  392 + "name=\"files\"; filename=\"fi;le1.txt\"\r\n" +
  393 + "Content-Type: text/plain\r\n"
  394 + params["files"][:name].should.equal "files"
  395 + params["files"][:tempfile].read.should.equal "contents"
  396 + end
  397 +
386 398 specify "should not include file params if no file was selected" do
387 399 env = Rack::MockRequest.env_for("/", multipart_fixture(:none))
388 400 params = Rack::Utils::Multipart.parse_multipart(env)

0 comments on commit 354073d

Please sign in to comment.
Something went wrong with that request. Please try again.