# Image Onebox breaks on Wikimedia links

**URL:** <https://meta.discourse.org/t/image-onebox-breaks-on-wikimedia-links/41197>\
**Category:** Bug\
**Created:** [Mars 17, 2016, 2:25 UTC](https://meta.discourse.org/t/image-onebox-breaks-on-wikimedia-links/41197 "2016-03-17T14:25:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![phw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/phw/32/285652_2.png) [@phw](https://meta.discourse.org/u/phw)\
**Post date:** [Mars 17, 2016, 2:25 UTC](https://meta.discourse.org/t/image-onebox-breaks-on-wikimedia-links/41197/1 "2016-03-17T14:25:26Z")

</div>

If you link to Wikimedia with a link like [File:Stones members montage2.jpg - Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Stones_members_montage2.jpg) the image onebox is triggered, trying to display this link as an image (which it isn’t, it is just the info page about that image):

> **[File:Stones members montage2.jpg](https://commons.wikimedia.org/wiki/File:Stones_members_montage2.jpg)**

There are two possible solutions:

1. Just ignore links to [common.wikimedia.org](http://common.wikimedia.org) in the image onebox
2. Use the Wikipedia API to get the actual link to the image itself

The latter requires an additional request, the resolved URL looks something like [https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Stones\_members\_montage2.jpg/250px-Stones\_members\_montage2.jpg](https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Stones_members_montage2.jpg/250px-Stones_members_montage2.jpg) . Not sure whether this should be added to the existing image onebox or if there should be a separate wikimedia onebox. I have some crude code to do the conversion from the [commons.wikimedia.org](http://commons.wikimedia.org) URL to the actual image URL here:

[https://github.com/phw/discourse-musicbrainz-onebox/blob/master/engine/wikimedia.rb](https://github.com/phw/discourse-musicbrainz-onebox/blob/master/engine/wikimedia.rb)

---

_[View the full topic](https://meta.discourse.org/t/image-onebox-breaks-on-wikimedia-links/41197)._
