When using a colon in the title or alt attribute, filter_xss_bad_protocol() filters text.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SpaghettiBolognese created an issue. See original summary.

SpaghettiBolognese’s picture

This patch solves our problems in d7.

awochna’s picture

#2 worked for me.

SpaghettiBolognese’s picture

Title: Wrong behaviour if alt and title attribute contains colon » Wrong behaviour if alt or title attribute contains colon
Issue summary: View changes
Status: Active » Needs review

  • axel.rutz committed ea7aa1f on 7.x-1.x
    Issue #2570715 by SpaghettiBolognese, awochna: Wrong behaviour if alt or...
geek-merlin’s picture

Status: Needs review » Fixed
cboyden’s picture

This update is causing other HTML entities in alt and title text to be encoded, and even double-encoded, when using the Media WYSIWYG button to insert media. I tested this with versions 1.6-RC7 of wysiwyg_filter and 2.11 of Media.

When you insert an image with the Media WYSIWYG button, you go through two steps where there are Alt and Title fields. The first is right after you upload a new image, and the 2nd is the Style Selector. If you enter some alt text with entities in the first form, such as

Alt & some > "character's" < 

the alt text that is rendered in the source code is

alt="Alt &amp;amp; some &amp;gt; &amp;quot;character&amp;#039;s&amp;quot; &amp;lt;"

which then looks like

Alt &amp; some &gt; &quot;character&#039;s&quot; &lt;

if you are seeing the alt text in place of the image, or reading it with a screenreader.

geek-merlin’s picture

Version: 7.x-1.6-rc2 » 7.x-1.x-dev
Status: Fixed » Needs work

Thanks for reporting!
So this must be reverted.

  • axel.rutz committed a06f1fe on 7.x-1.x
    Revert "Issue #2570715 by SpaghettiBolognese, awochna: Wrong behaviour...
geek-merlin’s picture

Patch in #2105841: Xss filter() mangles image captions and title/alt/data attributes indicates that core omits alt and title from filtering altogether (in fact it looks like original module code was copied from there). Patch appreciated.