Commit 61c2b96a by Brian Wilson

Only permit ascii characters in filenames generated from course_ids.

parent e26b86de
...@@ -83,10 +83,11 @@ def export_course_to_directory(course_key, root_dir): ...@@ -83,10 +83,11 @@ def export_course_to_directory(course_key, root_dir):
raise CommandError("Invalid course_id") raise CommandError("Invalid course_id")
# The safest characters are A-Z, a-z, 0-9, <underscore>, <period> and <hyphen>. # The safest characters are A-Z, a-z, 0-9, <underscore>, <period> and <hyphen>.
# We represent the first four with \w, but generalize to all unicode alphanumerics. # We represent the first four with \w.
# TODO: Once we support courses with unicode characters, we will need to revisit this.
replacement_char = u'-' replacement_char = u'-'
course_dir = replacement_char.join([course.id.org, course.id.course, course.id.run]) course_dir = replacement_char.join([course.id.org, course.id.course, course.id.run])
course_dir = re.sub(r'[^\w\.\-]', replacement_char, course_dir, flags=re.UNICODE) course_dir = re.sub(r'[^\w\.\-]', replacement_char, course_dir)
export_to_xml(store, None, course.id, root_dir, course_dir) export_to_xml(store, None, course.id, root_dir, course_dir)
......
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