summary refs log tree commit
diff options
context:
space:
mode:
authorJames Tucker <jftucker@gmail.com>2014-07-19 21:24:11 -0700
committerJames Tucker <jftucker@gmail.com>2014-07-19 21:24:11 -0700
commit5a9ffeb77c613e3611262f1182284f1d7df393a8 (patch)
tree7b7228252d9697e28143250e32dd04a267fc353c
parent9269d22c56762076e3b775ea65ec1d40494d2402 (diff)
downloadrack-5a9ffeb77c613e3611262f1182284f1d7df393a8.tar.gz
Revert "support empty string multipart filename"
This reverts commit 9269d22c56762076e3b775ea65ec1d40494d2402.
-rw-r--r--lib/rack/multipart/parser.rb4
-rw-r--r--test/multipart/ie116
-rw-r--r--test/spec_multipart.rb22
3 files changed, 3 insertions, 29 deletions
diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb
index 324c7d8c..22f9734b 100644
--- a/lib/rack/multipart/parser.rb
+++ b/lib/rack/multipart/parser.rb
@@ -116,10 +116,6 @@ module Rack
               name = filename
             end
 
-            if filename && filename.empty?
-              filename = name
-            end
-
             if filename
               (@env['rack.tempfiles'] ||= []) << body = Tempfile.new("RackMultipart")
               body.binmode  if body.respond_to?(:binmode)
diff --git a/test/multipart/ie11 b/test/multipart/ie11
deleted file mode 100644
index 6c3da47f..00000000
--- a/test/multipart/ie11
+++ /dev/null
@@ -1,6 +0,0 @@
---AaB03x
-Content-Disposition: form-data; name="files"; filename=""
-Content-Type: text/plain
-
-contents
---AaB03x--
diff --git a/test/spec_multipart.rb b/test/spec_multipart.rb
index 959a5cff..2acb6e0d 100644
--- a/test/spec_multipart.rb
+++ b/test/spec_multipart.rb
@@ -230,15 +230,12 @@ describe Rack::Multipart do
     params["files"][:tempfile].read.should.equal "contents"
   end
 
-  # n.b. this case used to be "do not include", but because ie11 now does this
-  # for selected files, that can no longer be done. It was decided that not
-  # losing data is better, and no browser is documented with this behavior.
-  should "include file params if no file was selected" do
+  should "not include file params if no file was selected" do
     env = Rack::MockRequest.env_for("/", multipart_fixture(:none))
     params = Rack::Multipart.parse_multipart(env)
     params["submit-name"].should.equal "Larry"
-    params["files"].should.not.equal nil
-    params.keys.should.include "files"
+    params["files"].should.equal nil
+    params.keys.should.not.include "files"
   end
 
   should "parse multipart/mixed" do
@@ -270,19 +267,6 @@ describe Rack::Multipart do
     params["files"][:tempfile].read.should.equal "contents"
   end
 
-  should "parse IE11 multipart upload" do
-    env = Rack::MockRequest.env_for("/", multipart_fixture(:ie11))
-    params = Rack::Multipart.parse_multipart(env)
-    params["files"][:type].should.equal "text/plain"
-    params["files"][:filename].should.equal "files"
-    params["files"][:head].should.equal "Content-Disposition: form-data; " +
-      "name=\"files\"; " +
-      'filename=""' +
-      "\r\nContent-Type: text/plain\r\n"
-    params["files"][:name].should.equal "files"
-    params["files"][:tempfile].read.should.equal "contents"
-  end
-
   should "parse filename and modification param" do
     env = Rack::MockRequest.env_for("/", multipart_fixture(:filename_and_modification_param))
     params = Rack::Multipart.parse_multipart(env)