diff --git a/common/djangoapps/static_replace/__init__.py b/common/djangoapps/static_replace/__init__.py index d41688530e..088ba09181 100644 --- a/common/djangoapps/static_replace/__init__.py +++ b/common/djangoapps/static_replace/__init__.py @@ -13,12 +13,22 @@ log = logging.getLogger(__name__) def _url_replace_regex(prefix): + """ + Match static urls in quotes that don't end in '?raw'. + + I'm sorry. http://xkcd.com/1171/ + + (?\\?['"]) # the opening quotes - (?P{prefix}) # theeprefix - (?P.*?) # everything else in the url - (?P=quote) # the first matching closing quote + (?x) # flags=re.VERBOSE + (?P\\?['"]) # the opening quotes + (?P{prefix}) # the prefix + (?P.*? # everything else in the url... + (?