summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index a5f79b14ac..c07f412442 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -1032,21 +1032,21 @@ class CGI
if "--" == $2
content_length = -1
end
- boundary_end = $2.dup
+ boundary_end = $2.dup
""
end
body.rewind
- /Content-Disposition:.* filename="?([^\";]*)"?/ni.match(head)
- filename = ($1 or "")
+ /Content-Disposition:.* filename=(?:"((?:\\.|[^\"\s])*)"|([^;\s]*))/ni.match(head)
+ filename = ($1 or $2 or "")
if /Mac/ni.match(env_table['HTTP_USER_AGENT']) and
/Mozilla/ni.match(env_table['HTTP_USER_AGENT']) and
(not /MSIE/ni.match(env_table['HTTP_USER_AGENT']))
filename = CGI::unescape(filename)
end
- /Content-Type: (.*)/ni.match(head)
+ /Content-Type: ([^\s]*)/ni.match(head)
content_type = ($1 or "")
(class << body; self; end).class_eval do
@@ -1055,7 +1055,7 @@ class CGI
define_method(:content_type) {content_type.dup.taint}
end
- /Content-Disposition:.* name="?([^\";]*)"?/ni.match(head)
+ /Content-Disposition:.* name="?([^\";\s]*)"?/ni.match(head)
name = $1.dup
if params.has_key?(name)