User blog comment:TOR/MediaWiki Upgrade/@comment-1627453-20120612170103/@comment-23865-20120612171222

It's exactly as Rappy and others have explained – a GIF will get a .gif extension, a PNG will get a .png extension and so on.

And for those of you more technical: yes, this uses MIME type detection that's already built into MediaWiki.