diff --git a/cms/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py index a06c07b4f2fa..daf47b0b3b1a 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -4,7 +4,6 @@ import json import logging import math -import mimetypes import re from functools import partial from urllib.parse import urljoin @@ -46,8 +45,7 @@ } -mimetypes.init() -all_mimetypes = list(mimetypes.types_map.values()) + ['text/javascript', 'text/php'] +allowed_mimetypes = settings.ALLOWED_FILE_TYPES @login_required @@ -461,7 +459,7 @@ def _get_sanitized_filename(filename): def _validate_mimetype(file_content_type): - if file_content_type in all_mimetypes: return file_content_type + if file_content_type in allowed_mimetypes: return file_content_type raise InvalidFileTypeException('{} of filetype is not supported'.format(file_content_type))