Page MenuHomePhabricator

Old revisions served with wrong content type
Closed, DeclinedPublic

Description

Author: cbm.wikipedia

Description:
The older file revisions of [[en:File:21st_World_Scout_Jamboree.svg]] are PNG images, the newest revision is an SVG. When I click on the older revisions, I get an XML parsing error in my browser. This made me suspect a bad content-type, which I confirmed (see below).

Apparently, the backend needs to check the file type explicitly for old revisions, not using the file extension or the stored type of the newest revision. Presumably the file type could be cached so that it is only checked once per image.

Trimmed output:
$ wget -S 'http://upload.wikimedia.org/wikipedia/en/archive/b/b9/20091220134945!21st_World_Scout_Jamboree.svg'

HTTP/1.0 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Mon, 20 Sep 2010 11:27:26 GMT
Content-Type: image/svg+xml
Last-Modified: Tue, 08 Dec 2009 22:22:29 GMT

Length: 71991 (70K) [image/svg+xml]

$ file 20091220134945\!21st_World_Scout_Jamboree.svg 20091220134945!21st_World_Scout_Jamboree.svg: PNG image, 300 x 300, 8-bit/color RGBA, non-interlaced


Version: unspecified
Severity: minor

Details

Reference
bz25226

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:11 PM
bzimport set Reference to bz25226.
bzimport added a subscriber: Unknown Object (MLST).

Other interesting questions:
*How did the image get uploaded in the first place. Don't we do checks on upload to stop this sort of thing?
*Why is the thumbnail of the old file http://upload.wikimedia.org/wikipedia/en/thumb/archive/b/b9/20091208222229!21st_World_Scout_Jamboree.svg/127px-21st_World_Scout_Jamboree.svg being served as application/x-wiki (?!)

Bryan.TongMinh wrote:

We do (In reply to comment #1)

Other interesting questions:
*How did the image get uploaded in the first place. Don't we do checks on
upload to stop this sort of thing?

We do now, but I think this has not always been the case.

That brings back an anecdote that I heart some time before: "we generally assume that information in the database is correct, except when it is not"

We do now, but I think this has not always been the case.

I could understand if we didn't back in the dark ages, but these files were uploaded in 2009, surely we had the checks back then?

Bryan.TongMinh wrote:

(In reply to comment #3)

We do now, but I think this has not always been the case.

I could understand if we didn't back in the dark ages, but these files were
uploaded in 2009, surely we had the checks back then?

Good question, local testing properly detects those files as image/png and refuses to upload them with an .svg extension.

Well the original files were deleted (Presumably still available at Special:Undelete)... I don't really think there's much we can do here. Fact is there are old files of the wrong type, as long as no new files can be uploaded like that, I think that is ok. I'm going to close this as WONTFIX (please don't hesitate to revert that decision if you disagree)