mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-09 11:30:00 +00:00
Update to make upload of m4a and m4b files work (#3102)
This commit is contained in:
parent
3cda0a0f32
commit
840f4d2010
@ -70,8 +70,8 @@ mimetypes.add_type('image/vnd.djv', '.djv')
|
||||
mimetypes.add_type('image/vnd.djv', '.djvu')
|
||||
mimetypes.add_type('application/mpeg', '.mpeg')
|
||||
mimetypes.add_type('audio/mpeg', '.mp3')
|
||||
mimetypes.add_type('application/mp4', '.m4a')
|
||||
mimetypes.add_type('application/mp4', '.m4b')
|
||||
mimetypes.add_type('audio/x-m4a', '.m4a')
|
||||
mimetypes.add_type('audio/x-m4a', '.m4b')
|
||||
mimetypes.add_type('audio/ogg', '.ogg')
|
||||
mimetypes.add_type('application/ogg', '.oga')
|
||||
mimetypes.add_type('text/css', '.css')
|
||||
|
@ -47,11 +47,11 @@ def del_temp_dir():
|
||||
|
||||
def validate_mime_type(file_buffer, allowed_extensions):
|
||||
mime = magic.Magic(mime=True)
|
||||
allowed_mimetypes =list()
|
||||
allowed_mimetypes = list()
|
||||
for x in allowed_extensions:
|
||||
try:
|
||||
allowed_mimetypes.append(mimetypes.types_map["." + x])
|
||||
except KeyError as e:
|
||||
except KeyError:
|
||||
log.error("Unkown mimetype for Extension: {}".format(x))
|
||||
tmp_mime_type = mime.from_buffer(file_buffer.read())
|
||||
file_buffer.seek(0)
|
||||
@ -66,6 +66,5 @@ def validate_mime_type(file_buffer, allowed_extensions):
|
||||
return True
|
||||
except:
|
||||
file_buffer.seek(0)
|
||||
pass
|
||||
|
||||
log.error("Mimetype '{}' not found in allowed types".format(tmp_mime_type))
|
||||
return False
|
||||
|
@ -42,7 +42,7 @@ natsort>=2.2.0,<8.5.0
|
||||
comicapi>=2.2.0,<3.3.0
|
||||
|
||||
# Kobo integration
|
||||
jsonschema>=3.2.0,<4.23.0
|
||||
jsonschema>=3.2.0,<4.24.0
|
||||
|
||||
# Hide console Window on Windows
|
||||
pywin32>=220,<310 ; sys_platform == 'win32'
|
||||
|
Loading…
Reference in New Issue
Block a user