Skip to content

Commit

Permalink
Merge pull request #499 from edly-io/hina/file-type-fix
Browse files Browse the repository at this point in the history
fix: file upload issue valid filetypes
  • Loading branch information
hinakhadim authored Jan 22, 2024
2 parents 0f81887 + 596ef7c commit 1af989b
Show file tree
Hide file tree
Showing 2 changed files with 3 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
1 change: 1 addition & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2714,3 +2714,4 @@

DISCUSSIONS_INCONTEXT_FEEDBACK_URL = ''
DISCUSSIONS_INCONTEXT_LEARNMORE_URL = ''
ALLOWED_FILE_TYPES = ['image/png', 'image/jpeg', 'application/pdf', 'application/msword', 'video/mp4']

0 comments on commit 1af989b

Please sign in to comment.