diff options
-rwxr-xr-x | fbin.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -30,7 +30,7 @@ class InactiveLoginError(BinError): pass class FileUploadFieldStorage(cgi.FieldStorage): def make_file(self, binary = None): # Make a temporary file in the destination directory, which will be renamed on completion. - return tempfile.NamedTemporaryFile(prefix = 'upload_', dir = settings.file_directory, delete = False) + return tempfile.NamedTemporaryFile(prefix = 'upload_', dir = settings.file_directory, delete = True) class Application(object): def get_or_create_user(self, username, jab_id): @@ -226,8 +226,6 @@ class Application(object): tempfile.tempdir = settings.file_directory form = FileUploadFieldStorage(fp = environ['wsgi.input'], environ = environ) if environ['REQUEST_METHOD'] != 'POST' or not 'file' in form or not 'filename' in form: - if 'file' in form: - form['file'].file.delete = True if user or settings.allow_anonymous_uploads: start_response('200 OK', [('Content-Type', 'text/html')]) return [str(templates.upload(searchList = {'settings': settings, 'user': user}))] @@ -241,6 +239,7 @@ class Application(object): filename = form.getvalue('filename') temp = form['file'].file + temp.delete = False # If the name attribute is missing, assume this is a StringIO object, then create a new temporary file and copy the contents. if not hasattr(temp, 'name'): |