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

Already on GitHub? Sign in to your account

Allow whitespace in url() #569

Open
wants to merge 4 commits into
from

Conversation

Projects
None yet
4 participants

This regex. should probably allow for whitespace between parenthesis and quotes or CssRewriteFilter will destroy the urls.

@johanberonius johanberonius Allow whitespace in url()
This regex. should probably allow for whitespace between parenthesis and quotes or CssRewriteFilter will destroy the urls.
d354d93
Collaborator

stof commented Feb 25, 2014

are they allowed in CSS ?

Afaik whitespaces are never allowed (unencoded) in URIs at all, are they? 😕

Update: Is it just update whitespace before and after the actual URL, but not within? The new regex looks like that.

url("http://example.com/foo.css");
url(    "http://example.com/foo.css"   );

Yes, exactly like the example. Not whitespace in the URL but outside of the quotes inside the parenthesis. Only \s* is added, the regex is otherwise unchanged.

Since the quotes are optional it could also be:

url(    http://example.com/foo.css   );
Collaborator

stof commented Feb 26, 2014

Please add a test covering this case

@johanberonius johanberonius Added more expected results in test of CssUtils::filterUrls to check …
…for correct handling of URLs surrounded by quotes and whitespace.
66b6a5e

Tests added for URLs surrounded by different combinations of quotes and/or whitespace.

New lines are supported, too. They currently don't match with the regex, or do they?

Collaborator

stof commented Feb 27, 2014

@apfelbox tabs are covered by \s

@stof yep, but they currently aren't covered in the tests (that's where the comment was placed).

Collaborator

stof commented Oct 14, 2014

shouldn't the same be done for imports ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment