diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-08-02 22:09:24 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-08-02 22:09:24 +0200 |
commit | d63a2fc22f9df562374ed3cf7b678deb0f9efa98 (patch) | |
tree | 7500216e5f18027d9e6cd0883a15ccd0c84054d3 | |
parent | 3b0bcbf2b6ccfc0e329cedd3532786f5a28e62d7 (diff) | |
download | fietsboek-d63a2fc22f9df562374ed3cf7b678deb0f9efa98.tar.gz fietsboek-d63a2fc22f9df562374ed3cf7b678deb0f9efa98.tar.bz2 fietsboek-d63a2fc22f9df562374ed3cf7b678deb0f9efa98.zip |
use fallback filename if no title is set
-rw-r--r-- | fietsboek/views/detail.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py index 8e296b7..d00aed3 100644 --- a/fietsboek/views/detail.py +++ b/fietsboek/views/detail.py @@ -97,7 +97,10 @@ def gpx(request): except FileNotFoundError: LOGGER.error("Track exists in database, but not on disk: %d", track.id) return HTTPInternalServerError() - wanted_filename = f"{track.id} - {util.secure_filename(track.title)}.gpx" + if track.title: + wanted_filename = f"{track.id} - {util.secure_filename(track.title)}.gpx" + else: + wanted_filename = f"{track.id}.gpx" content_disposition = f'attachment; filename="{wanted_filename}"' # We can be nice to the client if they support it, and deliver the gzipped # data straight. This saves decompression time on the server and saves a |