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

Ampersand (&) in alt-attribute is escaped over and over again #10451

Closed
baukezwaan opened this issue Aug 12, 2022 · 1 comment
Closed

Ampersand (&) in alt-attribute is escaped over and over again #10451

baukezwaan opened this issue Aug 12, 2022 · 1 comment

Comments

@baukezwaan
Copy link

baukezwaan commented Aug 12, 2022

Affected Version

Silverstripe 4.0 - 4.11

Description

When working in the CMS editor, the use of an ampersand is properly escaped by TinyMCE upon usage (via source or via inserting an image). However, when saving the page, the HTML is parsed by Silverstripe and escaped again. This results in over-and-over escaping the ampersand.

So instead of:

<p><img class="leftAlone ss-htmleditorfield-file image" title="Batman &amp; Robin" src="/assets/dummy.jpg" width="600" height="433" data-id="2" data-shortcode="image" /></p>

This results in (after hitting Save / Publish several times)

<p><img class="leftAlone ss-htmleditorfield-file image" title="Batman &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; Robin" src="/assets/dummy.jpg" width="600" height="433" data-id="2" data-shortcode="image" /></p>

Steps to Reproduce

  • Use a clean install of Silverstripe CMS
  • Open homepage in CMS
  • Insert an Image and set a alt-text (or title attribute) to a string with an ampersand
  • Check source code before saving (see alt="Batman &amp; Robin")
  • Hit Save or Publish
  • Check source code again and see alt="Batman &amp;amp;amp;amp; Robin"

PRs

@GuySartorelli
Copy link
Member

PRs merged. Github Actions will automatically tag patches once CI has finished running on the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants