Boost: preserve trailing slash on LCP cornerstone URLs#48871
Boost: preserve trailing slash on LCP cornerstone URLs#48871LiamSarsfield wants to merge 1 commit into
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
f8adb60 to
d65bdf4
Compare
| return array( | ||
| 'key' => self::get_provider_key( $url ), | ||
| 'url' => self::sanitize_url( $url ), | ||
| 'url' => $url, |
There was a problem hiding this comment.
sanitize_url() here is just untrailingslashit() - no escaping or validation. key still goes through it for dedup, so only the outbound url form changes.
Fixes HOG-562
Proposed changes
Cornerstone_Utils::prepare_provider_data()was stripping the trailing slash from cornerstone URLs before sending them to the Boost cloud LCP analyzer. Thekeyfield still uses the sanitised (trailing-slash-stripped) form so cloud-side dedup is unchanged, but theurlfield now passes through unmodified — preserving whatever formget_list()produced (which already applies the site's permalink-structure convention viamaybe_trailing_slash_urls).Does this pull request change what data or activity we track or use?
No.
Testing instructions
/about/.urlshould now end with/(e.g.https://example.com/about/), matching the canonical form WordPress would otherwise 301 to.Before this change the URL was sent without the trailing slash (
https://example.com/about). Sites whose edge treats the two forms differently — security plugins, WAFs, or hosting-level rules — could respond with redirects or 403s to the no-slash form, causing LCP analysis to fail on otherwise-valid cornerstone pages.