diff options
-rw-r--r-- | fietsboek/views/upload.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fietsboek/views/upload.py b/fietsboek/views/upload.py index 4ce41c8..9e38069 100644 --- a/fietsboek/views/upload.py +++ b/fietsboek/views/upload.py @@ -107,10 +107,15 @@ def finish_upload(request): date = gpx.time or gpx.get_time_bounds().start_time date = date.astimezone(timezone) tz_offset = timezone.utcoffset(date) + track_name = "" + for track in gpx.tracks: + if track.name: + track_name = track.name + break return { 'preview_id': upload.id, - 'upload_title': gpx.name, + 'upload_title': gpx.name or track_name, 'upload_date': date, 'upload_date_tz': int(tz_offset.total_seconds() // 60), 'upload_visibility': Visibility.PRIVATE, |