Skip to content

Commit

Permalink
fix: file upload issue valid filetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
hinakhadim committed Jan 19, 2024
1 parent 0f81887 commit f63066b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cms/djangoapps/contentstore/views/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
import logging
import math
import mimetypes
import re
from functools import partial
from urllib.parse import urljoin
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))


Expand Down

0 comments on commit f63066b

Please sign in to comment.