Ensures URLs are utf-8 encoded. Fixes #150

parent 8d33c511
...@@ -831,13 +831,13 @@ class DragAndDropBlock( ...@@ -831,13 +831,13 @@ class DragAndDropBlock(
for this. for this.
""" """
if hasattr(self.runtime, 'replace_urls'): if hasattr(self.runtime, 'replace_urls'):
url = self.runtime.replace_urls('"{}"'.format(url))[1:-1] url = self.runtime.replace_urls(u'"{}"'.format(url))[1:-1]
elif hasattr(self.runtime, 'course_id'): elif hasattr(self.runtime, 'course_id'):
# edX Studio uses a different runtime for 'studio_view' than 'student_view', # edX Studio uses a different runtime for 'studio_view' than 'student_view',
# and the 'studio_view' runtime doesn't provide the replace_urls API. # and the 'studio_view' runtime doesn't provide the replace_urls API.
try: try:
from static_replace import replace_static_urls # pylint: disable=import-error from static_replace import replace_static_urls # pylint: disable=import-error
url = replace_static_urls('"{}"'.format(url), None, course_id=self.runtime.course_id)[1:-1] url = replace_static_urls(u'"{}"'.format(url), None, course_id=self.runtime.course_id)[1:-1]
except ImportError: except ImportError:
pass pass
return url return url
......
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