summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMia Herkt <mia@0x0.st>2020-12-29 14:39:56 +0100
committerMia Herkt <mia@0x0.st>2021-05-23 19:13:51 +0200
commit3bdbab96c10f5ad01cb46c2af3009564b7d27997 (patch)
tree09c9fe0d1d6ab8d4d10495dd8ec02427e1933b77
parent73045dc5e563b6fcc41fc46e12ad54f70d3156d3 (diff)
Support client-defined names in file URL routing
This allows requests like /j4Tf.bin/myfilename.dat to be served without having to rewrite URLs at the frontend server.
-rwxr-xr-xfhost.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/fhost.py b/fhost.py
index e829f77..f939245 100755
--- a/fhost.py
+++ b/fhost.py
@@ -270,7 +270,7 @@ def store_url(url, addr):
@app.route("/<path:path>")
def get(path):
- path = Path(path)
+ path = Path(path.split("/", 1)[0])
sufs = "".join(path.suffixes[-2:])
name = path.name[:-len(sufs) or None]
id = su.debase(name)