Page MenuHomePhabricator

Some images in older revisions in file history delivered with wrong application/x-www-form-urlencoded mime-type
Open, LowPublic

Description

See the first revision in the file history for https://www.mediawiki.org/wiki/File:Page_Schemas_edit_schema_screenshot.png

Clicking on the thumbnail causes it to be downloaded rather than displayed in the browser. This is because it's being returned with Content-Type: application/x-www-form-urlencoded instead of Content-Type: image/png

The issue is probably a wrong Content-Type header stored in swift. The script maintenance/refreshFileHeaders.php fixes this for regular files (in the image table), but doesn't touch old revisions (stored in the archive table)

curl -I https://upload.wikimedia.org/wikipedia/mediawiki/archive/4/43/20131223221933%21Page_Schemas_edit_schema_screenshot.png

HTTP/2 200
date: Tue, 03 Apr 2018 14:55:14 GMT
content-type: application/x-www-form-urlencoded
content-length: 59957
x-object-meta-sha1base36: cgmtb8x39if29qk31qnfyqrijwmptq2
last-modified: Fri, 16 Mar 2018 17:36:28 GMT
etag: 8c256dd7abc0633daf73ea817d6643d6
x-timestamp: 1521221787.33738
x-trans-id: txcf5772ed7da641f0abab2-005ac38912
x-varnish: 67105164, 73084521 68296896, 727175899
via: 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1)
accept-ranges: bytes
age: 3263
x-cache: cp1063 pass, cp3037 hit/3, cp3038 miss
x-cache-status: hit-local
strict-transport-security: max-age=106384710; includeSubDomains; preload
x-analytics: https=1;nocookies=1
x-client-ip: 86.45.184.218
access-control-allow-origin: *
access-control-expose-headers: Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache, X-Varnish
timing-allow-origin: *

(see also T188831)