Skip to content

Commit

Permalink
parse_multipart: Content-Type field doesn't imply a file upload
Browse files Browse the repository at this point in the history
Fixes issues created by 6674f36.  [#79 state:resolved]
  • Loading branch information
leahneukirchen committed Feb 7, 2010
1 parent a6320b9 commit acffe8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit acffe8e

@seven1m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.