mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 11:09:16 +02:00
Fix #266: Ensure we do not store bad mimetypes
This commit is contained in:
parent
a00a6162c0
commit
5afc3e4637
3 changed files with 9 additions and 4 deletions
|
@ -43,9 +43,9 @@ def get_query(query_string, search_fields):
|
|||
|
||||
|
||||
def guess_mimetype(f):
|
||||
b = min(100000, f.size)
|
||||
b = min(1000000, f.size)
|
||||
t = magic.from_buffer(f.read(b), mime=True)
|
||||
if t == 'application/octet-stream':
|
||||
if not t.startswith('audio/'):
|
||||
# failure, we try guessing by extension
|
||||
mt, _ = mimetypes.guess_type(f.path)
|
||||
if mt:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue