Code

use the upload-supplied content-type if there is one
[roundup.git] / roundup / cgi / client.py
index 372100284369582e2cd7398054f5f2d00ec35276..b53a38cd8c6d812643817ea2295eb0eec19a4a2b 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: client.py,v 1.152 2004-01-19 23:56:07 richard Exp $
+# $Id: client.py,v 1.153 2004-01-20 03:58:38 richard Exp $
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
@@ -1778,8 +1778,11 @@ You should then receive another email with the new password.
                                 props['name'] = fn
                             # use this info as the type/filename properties
                             if propdef.has_key('type'):
-                                props['type'] = mimetypes.guess_type(fn)[0]
-                                if not props['type']:
+                                if hasattr(value, 'type'):
+                                    props['type'] = value.type
+                                elif mimetypes.guess_type(fn)[0]:
+                                    props['type'] = mimetypes.guess_type(fn)[0]
+                                else:
                                     props['type'] = "application/octet-stream"
                             # finally, read the content RAW
                             value = value.value