Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimetypes uses image/x-ms-bmp as the type for bmp files #66779

Closed
brma mannequin opened this issue Oct 9, 2014 · 9 comments
Closed

mimetypes uses image/x-ms-bmp as the type for bmp files #66779

brma mannequin opened this issue Oct 9, 2014 · 9 comments
Labels
3.7 easy expert-IO type-bug

Comments

@brma
Copy link
Mannequin

@brma brma mannequin commented Oct 9, 2014

BPO 22589
Nosy @bitdancer, @nitishch
PRs
  • #4756
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-12-08.12:51:43.854>
    created_at = <Date 2014-10-09.19:00:16.534>
    labels = ['easy', 'type-bug', '3.7', 'expert-IO']
    title = 'mimetypes uses image/x-ms-bmp as the type for bmp files'
    updated_at = <Date 2017-12-08.12:51:43.851>
    user = 'https://bugs.python.org/brma'

    bugs.python.org fields:

    activity = <Date 2017-12-08.12:51:43.851>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-12-08.12:51:43.854>
    closer = 'r.david.murray'
    components = ['IO']
    creation = <Date 2014-10-09.19:00:16.534>
    creator = 'brma'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 22589
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['228892', '307653', '307658', '307660', '307661', '307663', '307664', '307848', '307849']
    nosy_count = 4.0
    nosy_names = ['r.david.murray', 'brma', 'nitishch', 'jwatt']
    pr_nums = ['4756']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22589'
    versions = ['Python 3.7']

    @brma
    Copy link
    Mannequin Author

    @brma brma mannequin commented Oct 9, 2014

    In the file mimetypes.py the mime type for bmp files should be image/bmp for IE8 and later. the problem is that if the content header for 'nosniff' is set, then the bmp file fails to display due to the incorrect mime type.

    @brma brma mannequin added expert-IO type-bug labels Oct 9, 2014
    @jwatt
    Copy link
    Mannequin

    @jwatt jwatt mannequin commented Dec 5, 2017

    Using image/x-ms-bmp because that's all that IE7 supports makes no sense. Chrome doesn't support image/x-ms-bmp (it only supports the official IANA type image/bmp), so if the concern is over browser support then it's clear that Chrome (the browser with the most market share) should trump IE7 (a browser that stopped getting support/security updates at the beginning of 2016, and has virtually no browser share).

    @jwatt
    Copy link
    Mannequin

    @jwatt jwatt mannequin commented Dec 5, 2017

    I should note that while Chrome will refuse to open an image/x-ms-bmp file directly, when loaded as an image embedded in a document (e.g. via HTML's <img>) then Chrome doesn't care what MIME type it has. It will sniff the image stream and detect from its contents that it is a BMP image and correctly render it.

    @bitdancer
    Copy link
    Member

    @bitdancer bitdancer commented Dec 5, 2017

    If image/bmp is now[*] the official IANA type, mimetypes should use that. However, because this is a change with possible backward compatibility issues, it should probably only go into 3.7, but I'm open to arguments about that.

    [*] The mimetypes module is very old and nobody specifically maintains it; we depend on user reports for updates to it, and obviously this one was overlooked. Care to prepare a PR?

    @jwatt
    Copy link
    Mannequin

    @jwatt jwatt mannequin commented Dec 5, 2017

    If image/bmp is now[*] the official IANA type

    You can find image/bmp here:

    https://www.iana.org/assignments/media-types/media-types.xhtml#image

    @jwatt
    Copy link
    Mannequin

    @jwatt jwatt mannequin commented Dec 5, 2017

    I'm unfamiliar with the Python contribution procedures. If it's simply a case of cloning from github.com and putting up a PR then I can do that. I'm overloaded currently though, so if it's more involved than that it may take me a while to figure things out.

    @bitdancer
    Copy link
    Member

    @bitdancer bitdancer commented Dec 5, 2017

    That's the basis, but its a bit more complicated than that (NEWS item, putting bpo-22589 in the issue title, the question of signing a CLA, though a CLA doesn't really matter for this kind of change IMO). If you can't do it one of our core-mentorship volunteers will take care of it, I'm sure.

    @bitdancer bitdancer added the easy label Dec 5, 2017
    @bitdancer
    Copy link
    Member

    @bitdancer bitdancer commented Dec 8, 2017

    New changeset ede1573 by R. David Murray (Nitish Chandra) in branch 'master':
    bpo-22589 Changed MIME type of .bmp to "image/bmp" (bpo-4756)
    ede1573

    @bitdancer
    Copy link
    Member

    @bitdancer bitdancer commented Dec 8, 2017

    Thanks, nitishch. As I said, I'm not going to backport this unless someone advances an argument in favor that discusses the possible backward compatibility issue. (I'm not sure there are any significant ones, but someone needs to research it and present the results.)

    @bitdancer bitdancer added the 3.7 label Dec 8, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 easy expert-IO type-bug
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant