Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

parse_multipart: Content-Type field doesn't imply a file upload

Fixes issues created by 6674f36.  [#79 state:resolved]
  • Loading branch information...
commit acffe8ef5ea6de74fe306f2dd908b7681a21aaad 1 parent a6320b9
@chneukirchen chneukirchen authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/rack/utils.rb
View
2  lib/rack/utils.rb
@@ -503,7 +503,7 @@ def self.parse_multipart(env)
content_type = head[/Content-Type: (.*)#{EOL}/ni, 1]
name = head[/Content-Disposition:.*\s+name="?([^\";]*)"?/ni, 1] || head[/Content-ID:\s*([^#{EOL}]*)/ni, 1]
- if content_type || filename
+ if filename
body = Tempfile.new("RackMultipart")
body.binmode if body.respond_to?(:binmode)
end

1 comment on commit acffe8e

@seven1m

I think this broke something. Before this change, POSTS could have a multipart body with regular parameters inside (no filename= part). Now they cannot. Every parameter in the body must have a filename, otherwise line 548 (body.rewind) throws an exception: "Undefined method rewind for String."

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