From 50ab035d49885fc3989f81ebfbc7f0b882ee8740 Mon Sep 17 00:00:00 2001 From: Feanil Patel <feanil@edx.org> Date: Tue, 17 Dec 2019 15:06:52 -0500 Subject: [PATCH] Make the file name not have a 'b' prefix. We make sure the temp file name is a string because we combine it with other string components with path later. --- cms/djangoapps/contentstore/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index 01bbee23645..2e97557c1a3 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -32,7 +32,7 @@ from opaque_keys.edx.locator import LibraryLocator, BlockUsageLocator from organizations.models import OrganizationCourse from path import Path as path from pytz import UTC -from six import iteritems, text_type +from six import iteritems, text_type, binary_type from six.moves import range from user_tasks.models import UserTaskArtifact, UserTaskStatus from user_tasks.tasks import UserTask @@ -630,6 +630,9 @@ 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()) -- GitLab