Skip to content

Commit

Permalink
Fixes the handling of the filename parameter.
Browse files Browse the repository at this point in the history
Uses the RE used by Ruby in cgi.rb, that handles
the embedded semicolons in the filename correctly.

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information
drodriguez authored and leahneukirchen committed Oct 18, 2009
1 parent 354073d commit 337b758
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/utils.rb
Expand Up @@ -449,7 +449,7 @@ def self.parse_multipart(env)
head = buf.slice!(0, i+2) # First \r\n
buf.slice!(0, 2) # Second \r\n

filename = head[/Content-Disposition:.* filename="?([^\";]*)"?/ni, 1]
filename = head[/Content-Disposition:.* filename=(?:"((?:\\.|[^\"])*)"|([^;\s]*))/ni, 1]
content_type = head[/Content-Type: (.*)#{EOL}/ni, 1]
name = head[/Content-Disposition:.*\s+name="?([^\";]*)"?/ni, 1] || head[/Content-ID:\s*([^#{EOL}]*)/ni, 1]

Expand Down

0 comments on commit 337b758

Please sign in to comment.