This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dlchambers
Recipients dlchambers
Date 2012-06-27.16:03:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The current mimetypes.read_windows_registry() enums the values under HKCR\MIME\Database\Content Type
However, this is the key for mimetype to extension lookups, NOT for extension to mimetype lookups.
As a result, when >1 MIME types are mapped to a particular extension, the last-found entry is used.
For example, both "image/png" and "image/x-png" map to the ".png" file extension.
Unfortunately, what happens is this code finds "image/png", then later finds "image/x-png" and this steals the ".png" extension.

The solution is to use the correct regkey, which is the HKCR root.
This is the correct location for extension-to-mimetype lookups.
What we should do is enum the HKCR root, find all subkeys that start with a dot (i.e. file extensions), then inspect those for a 'Content Type' value.

The attached ZIP contains:  - this demonstrates the error (due to wrong regkey) and my fix (uses the correct regkey)   -   My suggested fix to the standard module.
Date User Action Args
2012-06-27 16:03:29dlchamberssetrecipients: + dlchambers
2012-06-27 16:03:29dlchamberssetmessageid: <>
2012-06-27 16:03:28dlchamberslinkissue15207 messages
2012-06-27 16:03:28dlchamberscreate