diff options
-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 |