django-static
django-static copied to clipboard
CSS url() with embed data surrounded by quotation marks is imporperly rendered
When someone embed data in CSS using url() and surrounds it with quotation marks " or ', django_static wrongly prepend current file path data. Example:
background-image: url("data:image/png;base64,...")
is rendered to:
background-image:url("/core/css/data:image/png;base64,...")
Proposed fix is to improve regexp in templatetags/django_static.py to this one:
REFERRED_CSS_URLS_REGEX = re.compile('''url\(((?!["']+data:)[^\)]+)\)''')
Oh, regexp fix should look like (? instead of + on qutoation marks match):
REFERRED_CSS_URLS_REGEX = re.compile('''url\(((?!["']?data:)[^\)]+)\)''')
If you make a pull request that fixes it, I'll merge it.
Pull request #36 made.