Asset urls must start w/ slash
LMS-11233
This commit is contained in:
committed by
Ben McMorran
parent
2839ad8711
commit
78879ebc18
@@ -146,7 +146,7 @@ def get_lms_link_for_about_page(course_key):
|
||||
def course_image_url(course):
|
||||
"""Returns the image url for the course."""
|
||||
loc = StaticContent.compute_location(course.location.course_key, course.course_image)
|
||||
path = loc.to_deprecated_string()
|
||||
path = StaticContent.serialize_asset_key_with_slash(loc)
|
||||
return path
|
||||
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ def _get_asset_json(display_name, date, location, thumbnail_location, locked):
|
||||
"""
|
||||
Helper method for formatting the asset information to send to client.
|
||||
"""
|
||||
asset_url = _add_slash(location.to_deprecated_string())
|
||||
asset_url = StaticContent.serialize_asset_key_with_slash(location)
|
||||
external_url = settings.LMS_BASE + asset_url
|
||||
return {
|
||||
'display_name': display_name,
|
||||
@@ -285,14 +285,8 @@ def _get_asset_json(display_name, date, location, thumbnail_location, locked):
|
||||
'url': asset_url,
|
||||
'external_url': external_url,
|
||||
'portable_url': StaticContent.get_static_path_from_location(location),
|
||||
'thumbnail': _add_slash(unicode(thumbnail_location)) if thumbnail_location else None,
|
||||
'thumbnail': StaticContent.serialize_asset_key_with_slash(thumbnail_location) if thumbnail_location else None,
|
||||
'locked': locked,
|
||||
# Needed for Backbone delete/update.
|
||||
'id': unicode(location)
|
||||
}
|
||||
|
||||
|
||||
def _add_slash(url):
|
||||
if not url.startswith('/'):
|
||||
url = '/' + url # TODO - re-address this once LMS-11198 is tackled.
|
||||
return url
|
||||
|
||||
Reference in New Issue
Block a user