summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2013-08-31 00:06:42 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2013-08-31 00:06:42 +0200
commit589c7c49d896aa73558d94bc233d6f65527ecb11 (patch)
treef33ddbf7d932b2826e7edfd8e4474d5a2e8bd3b7
parent143f638a4b1bafdc4a2a811a9f4c97a5392a0acc (diff)
Return 404 if file hash does not exist.
-rwxr-xr-xfbin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/fbin.py b/fbin.py
index 1d70712..e6a2b3f 100755
--- a/fbin.py
+++ b/fbin.py
@@ -204,8 +204,8 @@ class Application(object):
if '.' in hash:
hash = hash.split('.')[0]
file = self.get_file(hash, True)
- filename = file.get_path()
- if filename == None:
+ filename = file.get_path() if file else None
+ if file == None or filename == None:
start_response('404 Not Found', [('Content-Type', 'text/html')])
return ['<h1>Not Found</h1><p>The file you requested does not exist.</p>']