Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS url() with embed data surrounded by quotation marks is imporperly rendered #35

Open
lysyloren opened this issue Oct 8, 2014 · 3 comments

Comments

@lysyloren
Copy link

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:)[^\)]+)\)''')
@lysyloren
Copy link
Author

Oh, regexp fix should look like (? instead of + on qutoation marks match):

REFERRED_CSS_URLS_REGEX = re.compile('''url\(((?!["']?data:)[^\)]+)\)''')

@peterbe
Copy link
Owner

peterbe commented Oct 10, 2014

If you make a pull request that fixes it, I'll merge it.

@lysyloren
Copy link
Author

Pull request #36 made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants