From 5a9ffeb77c613e3611262f1182284f1d7df393a8 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Sat, 19 Jul 2014 21:24:11 -0700 Subject: Revert "support empty string multipart filename" This reverts commit 9269d22c56762076e3b775ea65ec1d40494d2402. --- lib/rack/multipart/parser.rb | 4 ---- test/multipart/ie11 | 6 ------ test/spec_multipart.rb | 22 +++------------------- 3 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 test/multipart/ie11 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) -- cgit v1.2.3-24-ge0c7