diff --git a/cps/__init__.py b/cps/__init__.py index fead0d2f43..642f6a6e16 100755 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -70,8 +70,8 @@ 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') diff --git a/cps/file_helper.py b/cps/file_helper.py index 095b5ee096..d618231100 100644 --- a/cps/file_helper.py +++ b/cps/file_helper.py @@ -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 diff --git a/optional-requirements.txt b/optional-requirements.txt index 77f41e1e25..3f6b6e37d6 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -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'