-
Notifications
You must be signed in to change notification settings - Fork 224
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
Closes #7146: 3.18: Preconnect for Google fonts isnot removed when Host Google fonts locally option is enabled #7158
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
Thank you, @Miraeld, for the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Miraeld I think this is risky to remove all link
with rel
equals preconnect
or dns-prefetch
, what do u think?
instead we may get the common pattern for the local fonts if that option is enabled, what do u think?
Good Catch |
@wordpressfan , we could add the google font domain to make it less general. Haven't thought of that. |
@wordpressfan, thanks for pointing this out. You’re absolutely correct—it’s clear from the screenshot that all preconnect instances have been removed, whereas the first one should have been retained. Moving this back to “In Progress” as a result. |
@wordpressfan & @hanna-meda regex has been changed to be far less general. :) |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you once again, @Miraeld, for this PR.
Everything looks good now: the prefetch
and preconnect
lines related to fonts.gstatic
and googleapi
are removed while unrelated link rel="preconnect"
and link rel="dns-prefetch"
entries remain intact.
Description
Fixes #7146
It'll remove the preconnect tag when google font hosting is ON and loaded from a local font.
Type of change
Detailed scenario
Just follow the issue scenario.
Technical description
Documentation
This pull request involves a significant update to the pattern used for removing preconnect and prefetch links in the
remove_preconnect_and_prefetch
function within theController.php
file. The main change is the adjustment of the regular expression pattern to improve its accuracy and efficiency.Changes to the regular expression pattern:
inc/Engine/Media/Fonts/Frontend/Controller.php
: Updated the regular expression pattern in theremove_preconnect_and_prefetch
function to better match and remove preconnect and prefetch links. The new pattern is more precise in identifying therel
attribute and its values, ensuring that it correctly handles various whitespace and attribute order scenarios.New dependencies
None
Risks
None
Mandatory Checklist
Code validation
Code style