summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-09-24 20:41:00 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2012-09-24 20:41:00 +0200
commit9c915bab172a4d5a2d9aed056c9261cd7b0cbd60 (patch)
treed4a0739ba34dc6e6be86495e0f0fe2f2acc23f9f
parent3286302f7bade0029210c4942565fac905c42216 (diff)
Delete uploaded temporary file on missing metadata.
-rwxr-xr-xfbin.py2
1 files changed, 2 insertions, 0 deletions
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}))