Skip to content

Conversation

@hscheffknecht
Copy link

For CSS files with url("") and any other url() within one line, the second file was ignored.

See https://regex101.com/r/IkhmxT/2

Sure, "url()" is invalid CSS syntax, but this should be ignored and other URLs in the same line should get handled correctly.

@matthiasmullie matthiasmullie force-pushed the master branch 5 times, most recently from 85ee174 to 227f190 Compare December 27, 2020 21:43
@xerc
Copy link
Contributor

xerc commented Sep 7, 2021

please check for both ["] & ['] ; /url\((["']?)([^"']+?)\1\)/i

@hscheffknecht
Copy link
Author

Done

protected function importFiles($source, $content)
{
$regex = '/url\((["\']?)(.+?)\\1\)/i';
$regex = '/url\((["\']?)([^"\']+?)\\1\)/i';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a problem when a quote is encountered inside the url.
I think changing the regex to '/url\((["\']?)(.*?)\\1\)/i'; instead of '/url\((["\']?)(.+?)\\1\)/i'; (note the * instead of +, which would allow an empty url value) should also work.
Could you confirm whether that fixes your issue, and resubmit if so?
Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an empty URL should not get parsed

@matthiasmullie matthiasmullie force-pushed the master branch 3 times, most recently from 949e01d to 51d1aa4 Compare November 18, 2022 12:22
@matthiasmullie matthiasmullie force-pushed the master branch 2 times, most recently from 9ddadb8 to 4c4ecee Compare March 6, 2025 09:42
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

Successfully merging this pull request may close these issues.

4 participants