Commit 299b1d04 authored by Jim Fulton's avatar Jim Fulton

Applied patch from Elliot Lee that makes test for file-upload more selective,

in keeping with RFC 1867.
parent d35d2753
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.22 $'[11:-2] __version__='$Revision: 1.23 $'[11:-2]
import regex, sys, os, string import regex, sys, os, string
from string import lower, atoi, rfind, split, strip, join, upper, find from string import lower, atoi, rfind, split, strip, join, upper, find
...@@ -317,9 +317,10 @@ class HTTPRequest(BaseRequest): ...@@ -317,9 +317,10 @@ class HTTPRequest(BaseRequest):
if (hasattr(item,'file') and hasattr(item,'filename') if (hasattr(item,'file') and hasattr(item,'filename')
and hasattr(item,'headers')): and hasattr(item,'headers')):
if (item.file and if (item.file and
(item.filename is not None or (item.filename is not None
'content-type' in map(lower, # RFC 1867 says that all fields get a content-type.
item.headers.keys()))): # or 'content-type' in map(lower, item.headers.keys())
)):
item=FileUpload(item) item=FileUpload(item)
else: else:
item=item.value item=item.value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment