**Steps to replicate the issue** (include links if applicable):
* On galleries with items having a "link=" (on wp.fr "lien="), the images cannot be seen in the image viewer
**What happens?**:
* On this version of the page, images cannot be viexed in the image viewer (i.e. https://fr.wikipedia.org/wiki/<article name>#/media/<file name>) : https://fr.wikipedia.org/w/index.php?title=L%C3%A9on_%26_L%C3%A9vy&oldid=209930178#Galerie
** The same happens on wp.en : https://en.wikipedia.org/w/index.php?title=User:SyntaxTerror/sandbox&oldid=1186519276
**What should have happened instead?**:
* On this newer version of the page, where the "lien=" parameters have been removed, the images can be seen in the image viewer (e.g. the first one in https://fr.wikipedia.org/w/index.php?title=L%C3%A9on_%26_L%C3%A9vy&oldid=209936545#/media/Fichier:Tramway_devant_la_gare_des_Brotteaux_de_Lyon.tif )
**Other information** (browser name/version, screenshots, etc.):
May be related to https://phabricator.wikimedia.org/T49646