Merge pull request #1396 from edx/dcadams/fix_static_paths

Fix for static path parsing
This commit is contained in:
dcadams
2013-10-25 14:54:59 -07:00
2 changed files with 23 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ XASSET_THUMBNAIL_TAIL_NAME = '.jpg'
import os
import logging
import StringIO
from urlparse import urlparse, urlunparse
from xmodule.modulestore import Location
from .django import contentstore
@@ -125,8 +126,14 @@ class StaticContent(object):
a course_id
"""
org, course_num, __ = course_id.split("/")
loc = StaticContent.compute_location(org, course_num, path)
return StaticContent.get_url_path_from_location(loc)
# Generate url of urlparse.path component
scheme, netloc, orig_path, params, query, fragment = urlparse(path)
loc = StaticContent.compute_location(org, course_num, orig_path)
loc_url = StaticContent.get_url_path_from_location(loc)
# Reconstruct with new path
return urlunparse((scheme, netloc, loc_url, params, query, fragment))
def stream_data(self):
yield self._data