Skip to content

Commit

Permalink
fixed deletion of gpx track
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlocker8 committed Jan 7, 2024
1 parent 16ea72b commit 3baf6d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/blueprints/GpxTracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ def deleteGpxTrack(track_id: int):
if track is None:
return Response(status=204)

if track.gpxFileName is not None:
gpxFileName = str(track.gpxFileName)
if gpxFileName is not None:
track.gpxFileName = None
db.session.commit()

try:
os.remove(os.path.join(uploadFolder, str(track.gpxFileName)))
LOGGER.debug(f'Deleted linked gpx file "{track.gpxFileName}" for track with id {track_id}')
os.remove(os.path.join(uploadFolder, gpxFileName))
LOGGER.debug(f'Deleted linked gpx file "{gpxFileName}" for track with id {track_id}')
except OSError as e:
LOGGER.error(e)

Expand Down

0 comments on commit 3baf6d6

Please sign in to comment.