diff options
author | Daniel RodrÃguez Troitiño <drodrigueztroitino@yahoo.es> | 2009-10-08 08:51:11 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2009-10-18 20:43:12 +0200 |
commit | 337b758bfecc16d1401c336fb38684296dc280db (patch) | |
tree | 08b6562939cfd4def9148d85be10a91e3504e0f4 | |
parent | 354073d9a2071fa58e18d471bb6bd70dd171face (diff) | |
download | rack-337b758bfecc16d1401c336fb38684296dc280db.tar.gz |
Fixes the handling of the filename parameter.
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>
-rw-r--r-- | lib/rack/utils.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb index 74303eff..884e6045 100644 --- a/lib/rack/utils.rb +++ b/lib/rack/utils.rb @@ -449,7 +449,7 @@ module Rack 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] |