From 9c915bab172a4d5a2d9aed056c9261cd7b0cbd60 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 24 Sep 2012 20:41:00 +0200 Subject: Delete uploaded temporary file on missing metadata. --- fbin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fbin.py b/fbin.py index 7667414..726a87c 100755 --- a/fbin.py +++ b/fbin.py @@ -237,6 +237,8 @@ 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 start_response('200 OK', [('Content-Type', 'text/html')]) return str(templates.upload(searchList = {'root': settings.virtual_root, 'user': user})) -- cgit v1.2.3