Skip to content
Snippets Groups Projects
Verified Commit 6e168a54 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #204: missing dot when downloading file

parent 8d2529f4
No related branches found
No related tags found
No related merge requests found
...@@ -467,7 +467,7 @@ class TrackFile(models.Model): ...@@ -467,7 +467,7 @@ class TrackFile(models.Model):
@property @property
def filename(self): def filename(self):
return '{}{}'.format( return '{}.{}'.format(
self.track.full_name, self.track.full_name,
self.extension) self.extension)
......
...@@ -275,6 +275,9 @@ def handle_serve(track_file): ...@@ -275,6 +275,9 @@ def handle_serve(track_file):
file_path = get_file_path(audio_file) file_path = get_file_path(audio_file)
elif f.source and f.source.startswith('file://'): elif f.source and f.source.startswith('file://'):
file_path = get_file_path(f.source.replace('file://', '', 1)) file_path = get_file_path(f.source.replace('file://', '', 1))
if mt:
response = Response(content_type=mt)
else:
response = Response() response = Response()
filename = f.filename filename = f.filename
mapping = { mapping = {
......
...@@ -77,3 +77,11 @@ def test_audio_track_mime_type(extention, mimetype, factories): ...@@ -77,3 +77,11 @@ def test_audio_track_mime_type(extention, mimetype, factories):
tf = factories['music.TrackFile'](audio_file__from_path=path) tf = factories['music.TrackFile'](audio_file__from_path=path)
assert tf.mimetype == mimetype assert tf.mimetype == mimetype
def test_track_file_file_name(factories):
name = 'test.mp3'
path = os.path.join(DATA_DIR, name)
tf = factories['music.TrackFile'](audio_file__from_path=path)
assert tf.filename == tf.track.full_name + '.mp3'
Fixed missing dot when downloading file (#204)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment