Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file upload issue valid filetypes #499

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
hinakhadim marked this conversation as resolved.
Show resolved Hide resolved


@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
Loading