diff --git a/boards/models/attachment/viewers.py b/boards/models/attachment/viewers.py --- a/boards/models/attachment/viewers.py +++ b/boards/models/attachment/viewers.py @@ -30,6 +30,7 @@ FILE_TYPES_AUDIO = ( 'audio/mp3', 'audio/opus', 'audio/x-flac', + 'audio/mpeg', ) FILE_TYPES_IMAGE = ( 'image/jpeg', diff --git a/boards/utils.py b/boards/utils.py --- a/boards/utils.py +++ b/boards/utils.py @@ -135,7 +135,7 @@ def get_upload_filename(model_instance, def get_file_mimetype(file) -> str: - file_type = magic.from_buffer(file.chunks().__next__(), mime=True) + file_type = magic.from_file(settings.MEDIA_ROOT + file.name, mime=True) if file_type is None: file_type = 'application/octet-stream' elif type(file_type) == bytes: