summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-02-15 23:55:13 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-02-15 23:55:13 +0100
commit3501212e14528807a02f43284423fd274bb19731 (patch)
tree71e894ba4844f3fcf35099266c20ad6d9bb382eb
parent12ada83027694f799d6ee5caddb00f5ffe1b4d8d (diff)
Allow for more file request variations.
-rwxr-xr-xfbin.py3
-rw-r--r--templates/uploaded.tmpl7
2 files changed, 9 insertions, 1 deletions
diff --git a/fbin.py b/fbin.py
index 507512e..39ae6d8 100755
--- a/fbin.py
+++ b/fbin.py
@@ -90,6 +90,8 @@ class Application(object):
def file(self, environ, start_response, path):
hash = path[1]
+ if '.' in hash:
+ hash = hash.split('.')[0]
filename = self.get_file_path(hash)
if filename == None:
start_response('404 Not Found', [('Content-Type', 'text/html')])
@@ -127,6 +129,7 @@ class Application(object):
'user': user,
'hash': hash,
'filename': filename,
+ 'ext': os.path.splitext(filename)[1],
'scheme': environ['wsgi.url_scheme'],
'host': environ['HTTP_HOST'],
}))
diff --git a/templates/uploaded.tmpl b/templates/uploaded.tmpl
index e36fc53..019160f 100644
--- a/templates/uploaded.tmpl
+++ b/templates/uploaded.tmpl
@@ -2,7 +2,12 @@
#def header: upload
#extends templates.base
#def content
- <p>Your file has been uploaded: <a href="/f/$hash/$filename">$scheme://$host/f/$hash/$filename</a>.
+ <p>Your file has been uploaded:
+ <ul>
+ <li><a href="/f/$hash/$filename">$scheme://$host/f/$hash/$filename</a></li>
+ <li><a href="/f/$hash">$scheme://$host/f/$hash</a></li>
+ <li><a href="/f/$hash$ext">$scheme://$host/f/$hash$ext</a></li>
+ </ul></p>
#if $user
<p>Your file will also appear in <a href="/m">your file list</a>.</p>
#else