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).
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