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

Fix notice and wrong Regex #781

Merged
merged 4 commits into from
Dec 10, 2024
Merged

Conversation

timotei-litespeed
Copy link
Contributor

@timotei-litespeed timotei-litespeed marked this pull request as draft November 26, 2024 00:25
@timotei-litespeed timotei-litespeed marked this pull request as ready for review November 26, 2024 00:37
@timotei-litespeed timotei-litespeed changed the title Fix Fix notice and wrong Regex Nov 26, 2024
src/cdn.cls.php Outdated
foreach ($matches[1] as $k => $url) {
if ($url == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we just use if (!$url) as empty case should be bypassed as well??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, added the changed

src/cdn.cls.php Outdated
@@ -306,8 +306,12 @@ private function _replace_inline_css()
* @see #685485
* @since 3.0
*/
preg_match_all('/url\((?![\'"]?data)[\'"]?([^\)\'"\\\]+)[\'"]?\)/i', $this->content, $matches);
preg_match_all('/url\((?![\'"]?data)[\'"]?(.*?)[\'"]?\)/i', $this->content, $matches);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we change (.*?) to (.+?)? @timotei-litespeed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed, at least it will filter out empty url :)

src/cdn.cls.php Outdated
foreach ($matches[1] as $k => $url) {
if (!$url) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As its used + now, is this condition redundant? @timotei-litespeed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@hi-hai hi-hai merged commit f5f6a79 into litespeedtech:dev Dec 10, 2024
1 check failed
@timotei-litespeed timotei-litespeed deleted the notice_fix branch December 10, 2024 20:44
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.

2 participants