Problems with data-description and HTML in image Descriptions

Issue #24 resolved
Simon Perry created an issue

First off - Thanks for spending your time creating this great plugin.

Since upgrading to the latest version ( 1.4.10 ) we've been hitting an error with our RSS feed. The issue may be the way services (external to us and therefore out of our control) interrupted the RSS feed, or the way our RSS is formed.

I've spent quite some time trying to understand what's been malfunctioning. Below are the details I've found so far.

I've tried testing by switching options on and off, but haven't found a solution as yet, hence reporting it to you.

The issue appears to be linked to the 'data-description' now inserted with the code around our images in the RSS feed.

Our internal procedure is that when we use a Creative Commons image, we insert the credit for the image, in HTML format, in that image's Description field within Wordpress Media.

eg this image http://onthewight.com/2013/12/20/heavy-rain-strong-winds-hit-island/windy-weather-contusion/ used in this story http://onthewight.com/2015/03/30/more-strong-winds-on-the-way/ has <em>Image: <a href="http://www.flickr.com/photos/contusion/7893300136/" title="">contusion</a> under <a href="http://creativecommons.org/licenses/by/2.0/" title="Creative Commons licence" target="_blank" rel="nofollow">CC BY 2.0</a></em> in its Description field in the Media as can be seen here http://imagizer.imageshack.com/img661/6659/c3kPXC.jpg

In description in the RSS output displays like this http://imagizer.imageshack.com/img909/7126/fjywem.png

This throws up a problem where the someone reading in our RSS feed is producing output that includes the (rogue characters highlighted)

http://imagizer.imageshack.com/img911/9568/2G31NU.png

_Looking at the problem

First off I thought the data-description was blank, so had its second quote missing. Only after studying it and picking through the code did I realise that the quotes are correctly formed, but the images Description field is confusing the situation, I suspect because of the many double-quotes - " - that come from the Description field.

_Solutions?

Do you suspect I'm right? If so, how can this be got around? Is it possible to have an option to exclude the data-description (I know you've only recently added it) or process the Description field somehow to avoid this double-quote overload?

Any and all ideas would be most welcome! :)

Thanks in advance for your help.

Comments (9)

  1. Ladislav Soukup repo owner
    • changed status to open

    hello, this is a bug in the plugin... I should check and clean any text inserted to data- tags, but I didn't. I will add a filter to escape the data-description attribute and I will add an option to enable / disable this feature.

    I will release a fixed version soon - at minimum, I can revert and remove the data-description tag until resolved.

    Sorry for this... I didn't test this update as I should... I should have expected this kind of string to appear in the description. There may be another problem with html or just quotation mark in any image meta field... I need to properly escape them.

  2. Simon Perry reporter

    How amazingly cool of you to answer so quickly. My mind is blown!

    Thanks for looking at it.

    Simon

  3. Ladislav Soukup repo owner

    I have just pushed hotfix to the WordPress plugin repository. Please try to update to version 1.4.11 - your problem should be fixed in this version. Please note, that after update you have to publish new post or edit existing post... this will force WordPress to drop the feed cache and rebuild the rss feed using new version of plugin.

    ( commit: bb208ad )

  4. Ladislav Soukup repo owner

    ok... sorry... it did work on my home server... I will do another update later today with better escaping... and I should have time to implement the on/off switch...

  5. Ladislav Soukup repo owner

    New version is online. The bug should be resolved... if not, there is a new settings option "Remove copyright meta" that will remove the tags from RSS feed completely. Please let me know if this helped or if the problem is still there.

  6. Ladislav Soukup repo owner

    ufff... :) in this version added the <![CDATA[ ]]> tags... they should safely fix the problem in the media:description tag, but it is not correct according the specification... (but is is correct XML structure). I should be using html entities and not this form of escaping, but this one actually seems to work... Hope this won't break anything on the 3rd party services...

    I also removed the data-description attribute from <img> tag as it is useless there and can cause problems you have reported.

    please let me know if you will find any other bug or problem.

  7. Simon Perry reporter

    Quick update - It all seems to be working as it should.

    Thanks again for your help and rapid action on this.

    Simon

  8. Log in to comment