Page MenuHomePhabricator

Embeddable HTML for file reuse is incorrect for files at the Commons
Closed, ResolvedPublic

Description

https://commons.wikimedia.org/wiki/Template:Cc-by-sa-layout and possibly other license templates contain extra whitespace and in particular line breaks in the HTML-based license metadata.

The "Use this file" function includes these linebreaks in the generated embedding HTML, which then doesn't work correctly (the license isn't linked).

For https://commons.wikimedia.org/wiki/File:Saint-Pierre-de-M%C3%A9sage_%2838%29_-_Salle_des_f%C3%AAtes.jpg#mediaviewer/File:Saint-Pierre-de-M%C3%A9sage_%2838%29_-_Salle_des_f%C3%AAtes.jpg

The HTML generated is

<p><a href="https://commons.wikimedia.org/wiki/File:Saint-Pierre-de-M%C3%A9sage_(38)_-_Salle_des_f%C3%AAtes.jpg#mediaviewer/File:Saint-Pierre-de-M%C3%A9sage_(38)_-_Salle_des_f%C3%AAtes.jpg"><img alt="Saint-Pierre-de-Mésage (38) - Salle des fêtes.jpg" src="https://upload.wikimedia.org/wikipedia/commons/2/20/Saint-Pierre-de-M%C3%A9sage_%2838%29_-_Salle_des_f%C3%AAtes.jpg" height="960" width="1280"></a><br>"<a href="https://commons.wikimedia.org/wiki/File:Saint-Pierre-de-M%C3%A9sage_(38)_-_Salle_des_f%C3%AAtes.jpg#mediaviewer/File:Saint-Pierre-de-M%C3%A9sage_(38)_-_Salle_des_f%C3%AAtes.jpg">Saint-Pierre-de-Mésage (38) - Salle des fêtes</a>" by <a href="commons.wikimedia.org/wiki/User:Parisdreux" title="User:Parisdreux" class="mw-redirect">Parisdreux</a> - <span class="int-own-work">Own work</span>. Licensed under <a title="Creative Commons Attribution-Share Alike 3.0
" href="http://creativecommons.org/licenses/by-sa/3.0
">CC BY-SA 3.0</a> via <a href="
commons.wikimedia.org/wiki/">Wikimedia Commons</a>.</p>

Note the linebreaks in the title and href attributes of the license link.

While this could be fixed in the templates, I think it'd be better to fix this in the MediaViewer by doing a trim() of the extracted metadata.


Version: unspecified
Severity: normal

Details

Reference
bz69497

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:45 AM
bzimport added a project: MediaViewer.
bzimport set Reference to bz69497.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to Lupo from comment #1)

BTW, it'd be very nice if the MediaViewer would just generate the links back
to the file

That is covered in bug 62266 instead.

(In reply to Andre Klapper from comment #3)

That is covered in bug 62266 instead.

I don't understand. Bug 62266 is about browser history, not about the backlink generated into embeddable HTML.

Does MediaViewer use the extmetadata API? If so, this bug should probably moved to the MediaWiki API component:

https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=extmetadata&format=jsonfm&titles=File:Saint-Pierre-de-M%C3%A9sage%20%2838%29%20-%20Salle%20des%20f%C3%AAtes.jpg

returns:

"UsageTerms": {

"value": "Creative Commons Attribution-Share Alike 3.0\n",
"source": "commons-desc-page",
"hidden": ""

},
"LicenseUrl": {

"value": "http://creativecommons.org/licenses/by-sa/3.0\n",
"source": "commons-desc-page",
"hidden": ""

},

Again, note the line breaks in the values.

  • This bug has been marked as a duplicate of bug 57458 ***