Image alternative text loses text preceding colon upon leaving plain-text editor or upon saving node

Created on 9 March 2017, almost 8 years ago
Updated 11 April 2024, 9 months ago

8.x Issue: #2105841: Xss filter() mangles image captions and title/alt/data attributes

If alternative text I add to an image has a colon, then the colon and any text preceding it are lost on exiting source code mode or upon saving.

This occurs whether Advanced content filter is set to Enabled or Disabled.
This occurs whether or not a content type uses Workbench Moderation.

Steps:

  1. Create or edit a node.
  2. If the page has an image, click on it and click the Image icon in the CKEditor UI. If the page doesn't have an image, click the Image icon in the CKEditor UI and insert one.
  3. In the Alternative Text field, type
    beginning text : colon , comma . period " quote ; semicolon ' single quote
  4. Click OK
  5. If editor has the power to Switch to plain text editor
    1. Click Switch to plain text editor
    2. Locate the image code
    3. Actual and expected results: image tag alt attribute is as follows
      alt="beginning text : colon , comma . period " quote ; semicolon ' single quote"
    4. Optional additional steps:
      1. Switch back to WYSIWYG
      2. Switch back to plain-text editor
      3. Find the img element
      4. Actual result: image tag alt attribute is as follows
        alt=" colon , comma . period " quote ; semicolon ' single quote"
        Expected result: image tag alt attribute is as follows
        alt="beginning text : colon , comma . period " quote ; semicolon ' single quote"
  6. Save
  7. View page source
  8. Actual result: image tag alt attribute is as follows
    alt=" colon , comma . period " quote ; semicolon ' single quote"
    Expected result: image tag alt attribute is as follows
    alt="beginning text : colon , comma . period " quote ; semicolon ' single quote"

I also confirmed that this issue happens in a simplytest.me sandbox with Drupal core 7.54 and CKEditor - WYSIWYG HTML editor 7.x-1.17 installed.

I attempted to test this on the CKEditor nightly build demo page to see whether I needed to report this issue to CKEditor's issue queue or to the Drupal CKEditor module's issue queue, but the CKEditor demo page does not allow saving. If I insert the image, add the alt text, click the Source button to see the source, then click Source again to return to the WYSIWYG, then again to return to source, I still see the expected
alt="beginning text : colon , comma . period " quote ; semicolon ' single quote"

CKEditor issue queue search on "colon" revealed no related issues.

🐛 Bug report
Status

Needs review

Version

7.0 ⚰️

Component
Filter 

Last updated 2 days ago

No maintainer
Created by

🇺🇸United States charles belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024