wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Remove '&amp' from self hosted GF font family

Open Mai-Saad opened this issue 7 months ago • 1 comments

Regression noticed

In version 3.19, an unintended & was introduced into the font-family markup for self-hosted Google Fonts.

This HTML entity was not present previously. This regression should be addressed to maintain ownership of any related problems to the sources and not the applied optimization.

Additional context

  • slack discussion https://group-onecom.slack.com/archives/C08F4LZB2QG/p1748249801607799
  • test page https://new.rocketlabsqa.ovh/combine_v1fonts_template-2
  • steps: 1- install/activate 3.19 2- disable preconnect external 3- enable self hosted GF 4- visit page mentioned above 5- check source

Describe the solution you'd like

As a general rule, we don't change markup unless it's necessary.

User story

As a developer processing self-hosted Google Fonts, I want the font-family markup to remain free of unnecessary HTML changes, like turning & to its HTML entity counter part &.

Acceptance Criteria

  • The font-family markup for self-hosted Google Fonts does not include the & entity unless pre-existing on the original markup
  • Version 3.19.x behavior is corrected to match the previous state experienced on 3.18.x

Mai-Saad avatar May 26 '25 09:05 Mai-Saad

Added acceptance criteria.

DahmaniAdame avatar Jun 02 '25 05:06 DahmaniAdame

Related Test Plan: https://wpmediaqa.testrail.io/index.php?/runs/view/1048 + explore the case where user input has & in the raw markup, to verify that the fix doesn't overcorrect and accidentally decode pre-encoded values.

hanna-meda avatar Jul 02 '25 13:07 hanna-meda

Reopening due to a new finding while testing #7379. Although it’s not a regression, but the same fix should be applied:

There’s an extra & in the data structure after hosted GF is applied.

  • More details in Slack thread

hanna-meda avatar Jul 07 '25 08:07 hanna-meda

@hanna-meda we don't need to reopen this issue. We just need to update the other PR with develop to have this fix there. I did that now, plz check it again there and confirm it works

wordpressfan avatar Jul 07 '25 08:07 wordpressfan

@wordpressfan, thank you for pointing this out. I just tested now and you're right, with the latest develop merged, point 2 is no longer an issue. Closing this as fixed.

hanna-meda avatar Jul 07 '25 09:07 hanna-meda