diff --git a/lms/djangoapps/mobile_api/video_outlines/tests.py b/lms/djangoapps/mobile_api/video_outlines/tests.py index c9ec4a7bc9..65729aa20b 100644 --- a/lms/djangoapps/mobile_api/video_outlines/tests.py +++ b/lms/djangoapps/mobile_api/video_outlines/tests.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Tests for video outline API """ @@ -100,11 +101,11 @@ class TestVideoAPITestCase(MobileAPITestCase): } ]}) - def _create_video_with_subs(self): + def _create_video_with_subs(self, custom_subid=None): """ Creates and returns a video with stored subtitles. """ - subid = uuid4().hex + subid = custom_subid or uuid4().hex transcripts_utils.save_subs_to_store( { 'start': [100, 200, 240, 390, 1000], @@ -578,3 +579,8 @@ class TestTranscriptsDetail(TestVideoAPITestCase, MobileAuthTestMixin, MobileEnr def test_incorrect_language(self): self.login_and_enroll() self.api_response(expected_response_code=404, lang='pl') + + def test_transcript_with_unicode_file_name(self): + self.video = self._create_video_with_subs(custom_subid=u'你好') + self.login_and_enroll() + self.api_response(expected_response_code=200, lang='en') diff --git a/lms/djangoapps/mobile_api/video_outlines/views.py b/lms/djangoapps/mobile_api/video_outlines/views.py index 54f65e4a6e..0288f42d4a 100644 --- a/lms/djangoapps/mobile_api/video_outlines/views.py +++ b/lms/djangoapps/mobile_api/video_outlines/views.py @@ -121,6 +121,6 @@ class VideoTranscripts(generics.RetrieveAPIView): raise Http404(u"Transcript not found for {}, lang: {}".format(block_id, lang)) response = HttpResponse(content, content_type=mimetype) - response['Content-Disposition'] = 'attachment; filename="{}"'.format(filename) + response['Content-Disposition'] = 'attachment; filename="{}"'.format(filename.encode('utf-8')) return response