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

Fixed ESI parsing error with turpentine #2987

Merged
merged 4 commits into from
Mar 16, 2023
Merged

Fixed ESI parsing error with turpentine #2987

merged 4 commits into from
Mar 16, 2023

Conversation

luigifab
Copy link
Contributor

@luigifab luigifab commented Jan 20, 2023

Description

With Nexcess Magento Turpentine for Varnish, sometimes there is a strange bug with ESI processing (ESI is not processed).

Example: window.location='https://.../fr/customer/address/delete/form_key/<esi:include src='http://.../fr/turpentine/esi/getFormKey/ttl/86400/method/esi/scope/global/access/private/' />/id/'+addressId;

In #2682, the solution is to invert ' and ".

But in fact, this is right and wrong (this must be done from Turpentine side).
The real solution is to remove CDATA tags (https://stackoverflow.com/a/4504180/2980105).
I think I have tested without and added them for the PR.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: Customer Relates to Mage_Customer Template : base Relates to base template labels Jan 20, 2023
fballiano
fballiano previously approved these changes Jan 21, 2023
kiatng
kiatng previously approved these changes Jan 30, 2023
@colinmollenhour
Copy link
Member

If the CDATA markers are removed doesn't everything need to be htmlescaped? E.g. " should either be inside a CDATA or escaped as &quot;?

@luigifab
Copy link
Contributor Author

luigifab commented Feb 3, 2023

My html validator is okay without the CDATA:

image

@elidrissidev
Copy link
Member

AFAIK, CDATA is required only for XML parsers since they consider any appearance of </ as a closing tag, even if it's inside quotes in JS.

Also see: https://stackoverflow.com/a/66865

@colinmollenhour
Copy link
Member

colinmollenhour commented Feb 4, 2023

Also see: https://stackoverflow.com/a/66865

There are a lot of answers there and I'm still confused as to what's "best" and it probably depends on your opening tag as well..

For the purpose of keeping your PR to one issue and not conflating another I think it would be best to separate the CDATA discussion from this pull request by reverting the CDATA change so it doesn't hold up your PR. Then if CDATA should be removed we could remove them everywhere, or just leave them and not fret over it.

@fballiano fballiano dismissed stale reviews from kiatng and themself via d7bdabf March 16, 2023 16:36
Copy link
Contributor

@fballiano fballiano left a comment

Choose a reason for hiding this comment

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

I've re-added CDATA as per the discussion so we can approve it and merge it

@fballiano fballiano merged commit 24176a8 into OpenMage:1.9.4.x Mar 16, 2023
@fballiano fballiano changed the title Fix esi parsing with turpentine Fixed ESI parsing error with turpentine Mar 16, 2023
fballiano added a commit that referenced this pull request Mar 16, 2023
* Fix esi parsing with turpentine

* re-added CDATA

---------

Co-authored-by: Fabrizio Balliano <[email protected]>
@fballiano
Copy link
Contributor

merged and cherrypicked to v20

@luigifab luigifab deleted the fix-esi-again branch March 16, 2023 20:25
@luigifab
Copy link
Contributor Author

luigifab commented Apr 14, 2023

Oh my bad. The CDATA was not removed in app/design/frontend/base/default/template/customer/address/book.phtml!
New PR coming soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Customer Relates to Mage_Customer Template : base Relates to base template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants