Commit c4216747 by Attiya Ishaque Committed by GitHub

Merge pull request #1005 from edx/ai/Edcucator-467-file-extention

All files with upper case extension changes into lowercase.
parents 3789d962 0c74d7d0
......@@ -298,7 +298,7 @@ class SubmissionMixin(object):
if self.file_upload_type == 'pdf-and-image' and content_type not in self.ALLOWED_FILE_MIME_TYPES:
return {'success': False, 'msg': self._(u"Content type must be PDF, GIF, PNG or JPG.")}
if self.file_upload_type == 'custom' and file_ext not in self.white_listed_file_types:
if self.file_upload_type == 'custom' and file_ext.lower() not in self.white_listed_file_types:
return {'success': False, 'msg': self._(u"File type must be one of the following types: {}").format(
', '.join(self.white_listed_file_types))}
......
<openassessment file_upload_type="custom" white_listed_file_types="pdf" submission_due="2035-03-11T18:20">
<title>
Global Poverty
</title>
<rubric>
<prompt>
Given the state of the world today, what do you think should be done to combat poverty?
Read for conciseness, clarity of thought, and form.
</prompt>
</rubric>
<assessments>
<assessment name="peer-assessment"
start="2014-03-11T10:00-18:10"
due="2035-12-21T22:22-7:00"
must_grade="1"
must_be_graded_by="1" />
<assessment name="self-assessment" />
</assessments>
</openassessment>
......@@ -221,6 +221,29 @@ class SubmissionTest(XBlockHandlerTestCase):
self.assertTrue(resp['success'])
self.assertEqual(u'', resp['url'])
@mock_s3
@override_settings(
AWS_ACCESS_KEY_ID='foobar',
AWS_SECRET_ACCESS_KEY='bizbaz',
FILE_UPLOAD_STORAGE_BUCKET_NAME="mybucket"
)
@scenario('data/custom_file_upload.xml')
def test_upload_files_with_uppercase_ext(self, xblock):
"""
Tests that files with upper case extention uploaded successfully
"""
xblock.xmodule_runtime = Mock(
course_id='test_course',
anonymous_student_id='test_student',
)
resp = self.request(xblock, 'upload_url', json.dumps({'contentType': 'filename',
'filename': 'test.PDF'}), response_format='json')
self.assertTrue(resp['success'])
self.assertTrue(resp['url'].startswith(
'https://mybucket.s3.amazonaws.com/submissions_attachments/test_student/test_course/' +
xblock.scope_ids.usage_id
))
class SubmissionRenderTest(XBlockHandlerTestCase):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment