Fix custom link label being double HTML-encoded on each save - #90
Open
boo-code wants to merge 1 commit into
Open
Fix custom link label being double HTML-encoded on each save#90boo-code wants to merge 1 commit into
boo-code wants to merge 1 commit into
Conversation
|
Hello @boo-code! This is your first pull request on ps_mainmenu repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
When editing a custom link, getAddLinkFieldsValues() decoded the link URL with Tools::htmlentitiesDecodeUTF8() before pre-filling the edit form, but left the label untouched. Ps_MenuTopLinks::getLinkLang() returns both values HTML-entity encoded (Tools::safeOutput), so the label was pre-filled already encoded and re-encoded on save, stacking the entities on every edit cycle (e.g. "À" -> "À" -> "À" -> ...) until the label became unreadable. Decode the label the same way the link is decoded, so the edit form shows the real value and saving it keeps it unchanged.
boo-code
force-pushed
the
fix/custom-link-label-double-encode-89
branch
from
July 29, 2026 01:41
9d04716 to
aca4667
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getAddLinkFieldsValues()decoded the link URL withTools::htmlentitiesDecodeUTF8()before pre-filling the edit form, but left the label untouched.Ps_MenuTopLinks::getLinkLang()returns both the link and the label HTML-entity encoded (viaTools::safeOutput()), so the label was pre-filled already encoded and then re-encoded on save, stacking the entities on every edit/save cycle (À→À→À→ …) until the label became unreadable in the BO and the front office. The fix decodes the label exactly the same way the link is decoded.À propos), save, then edit and save it again a few times without changing anything. Before: the label inps_linksmenutop_lang.label, in the link list and in the edit field gains an extra layer of HTML entities on each save. After: the label keeps its original value across saves. Verified against the database: editing a link whose stored label isÀ proposnow pre-fills the form withÀ proposinstead ofÀ propos, so re-saving leaves it unchanged.Root cause spotted by @Daaaaad in the issue —
getAddLinkFieldsValues()decoded$link['link']but not$link['label'].