Merge pull request #22581 from edx/feanil/fix_export_filename

Correct the output file name for exports.
This commit is contained in:
Feanil Patel
2019-12-19 14:24:44 -05:00
committed by GitHub
2 changed files with 1 additions and 4 deletions

View File

@@ -630,9 +630,6 @@ def create_export_tarball(course_module, course_key, context, status=None):
Updates the context with any error information if applicable.
"""
name = course_module.url_name
if isinstance(name, binary_type):
name = name.decode('utf-8')
export_file = NamedTemporaryFile(prefix=name + '.', suffix=".tar.gz")
root_dir = path(mkdtemp())

View File

@@ -277,7 +277,7 @@ def send_tarball(tarball, size):
"""
wrapper = FileWrapper(tarball, settings.COURSE_EXPORT_DOWNLOAD_CHUNK_SIZE)
response = StreamingHttpResponse(wrapper, content_type='application/x-tgz')
response['Content-Disposition'] = u'attachment; filename=%s' % os.path.basename(tarball.name.encode('utf-8'))
response['Content-Disposition'] = u'attachment; filename=%s' % os.path.basename(tarball.name)
response['Content-Length'] = size
return response