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.
This commit is contained in:
Mia Herkt 2020-12-29 14:39:56 +01:00
parent 73045dc5e5
commit 3bdbab96c1
Signed by: mia
GPG key ID: 72E154B8622EC191

View file

@ -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)