Skip to content

Commit a51b97a

Browse files
author
Richard Jones
committed
handle cases where mime type is not guessable
1 parent 84c7486 commit a51b97a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

roundup/cgi_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.25 2001-08-29 05:30:49 richard Exp $
18+
# $Id: cgi_client.py,v 1.26 2001-09-12 08:31:42 richard Exp $
1919

2020
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
2121

@@ -395,9 +395,11 @@ def newfile(self, message=None):
395395
if [i for i in keys if i[0] != ':']:
396396
try:
397397
file = self.form['content']
398+
type = mimetypes.guess_type(file.filename)[0]
399+
if not type:
400+
type = "application/octet-stream"
398401
self._post_editnode(cl.create(content=file.file.read(),
399-
type=mimetypes.guess_type(file.filename)[0],
400-
name=file.filename))
402+
type=type, name=file.filename))
401403
# and some nice feedback for the user
402404
message = '%s created ok'%cn
403405
except:
@@ -513,6 +515,9 @@ def parsePropsFromForm(cl, form, nodeid=0):
513515

514516
#
515517
# $Log: not supported by cvs2svn $
518+
# Revision 1.25 2001/08/29 05:30:49 richard
519+
# change messages weren't being saved when there was no-one on the nosy list.
520+
#
516521
# Revision 1.24 2001/08/29 04:49:39 richard
517522
# didn't clean up fully after debugging :(
518523
#

0 commit comments

Comments
 (0)