Fix #473: ".None" extension when downloading Flac file

This commit is contained in:
Eliot Berriot 2018-11-19 22:20:09 +01:00
parent 742ee9bc9b
commit 837d6ad0e1
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
4 changed files with 22 additions and 2 deletions

View file

@ -688,6 +688,10 @@ class Upload(models.Model):
@property
def extension(self):
try:
return utils.MIMETYPE_TO_EXTENSION[self.mimetype]
except KeyError:
pass
if not self.audio_file:
return
return os.path.splitext(self.audio_file.name)[-1].replace(".", "", 1)