[Yanel-dev] [FYI] 'image/pjpeg' & 'image/x-png' pseudo MIME-types
and how to work around them
Guillaume Déflache
guillaume.deflache at wyona.com
Wed Jun 9 10:19:07 CEST 2010
Hi!
When uploading JPEGs using Internet Explorer, one often comes across the
following problem: some images are sent by the browser with the
Content-Type set to 'image/pjpeg' which is not an official (i.e.
IANA-registered) MIME-type.
As usually one only rightfully tests for 'image/jpeg', these JPEGs
usually get rejected as being in an unkonwn format.
The workaround is to test for this abnormal MIME-type and when possible
reset it to 'image/jpeg' ASAP, or at least handle it as a regular JPEG.
This MIME-type was hacked as a kind of weak copyright protection
measure, and only occurs when the image has embedded copyright and/or
author metadata, cf.
http://www.evolve.co.nz/how-to-fix-a-pjpeg-image-upload-error.html for
the details.
Along the same lines old versions of Internet Explorer still uses the
non-standard 'image/x-png' instead of the standard 'image/x-png'.
It may make sense to try to filter both of these in the Yanel servlet
filter, as we already decorate some methods related to upload there
IIRC, to solve these problems once and for all for all Yanel-based
applications.
Microsoft kind of acknowledges these problems in
<http://msdn.microsoft.com/en-us/library/ms775147(VS.85).aspx#_replace>.
HTH,
Guillaume
More information about the Yanel-development
mailing list