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.

classification
Title: http.server doesn't guess n-quads, n-triples, notation3 and TriG MIME types
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: DylanVanAssche, eric.araujo, lukasz.langa, miss-islington
Priority: normal Keywords: patch

Created on 2020-10-26 17:56 by DylanVanAssche, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23230 merged DylanVanAssche, 2020-11-10 17:41
PR 29663 closed miss-islington, 2021-11-20 15:52
PR 29664 closed miss-islington, 2021-11-20 15:52
Messages (6)
msg379676 - (view) Author: Dylan Van Assche (DylanVanAssche) * Date: 2020-10-26 17:56
guess_format() from lib/mimetypes.py doesn't guess correctly the following MIME types:

- .nq: application/n-quads (specification: https://www.w3.org/TR/n-quads/)
- .nt: application/n-triples (specification: https://www.w3.org/TR/n-triples/)
- .n3: text/n3 (specification: https://www.w3.org/TeamSubmission/n3/)
- .trig: application/trig (specification: https://www.w3.org/TR/trig/)

In these cases the default MIME type is returned: application/octet-stream
msg379677 - (view) Author: Dylan Van Assche (DylanVanAssche) * Date: 2020-10-26 18:11
Adding the MIME types to /etc/mime.types fixes this issue, but I'm not sure if that's the right 'fix'
msg380291 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-11-03 18:52
Editing /etc/mime.types is one way of customizing the types returned; another one is to make a pull request to add them to the list inside the mimetypes module.
msg406664 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-20 15:52
New changeset ef5305819ff9b283d92dbf004f977592f4e64165 by Dylan Van Assche in branch 'main':
bpo-42158: Add MIME types for n-triples, n-quads, n3 and trig (GH-23230)
https://github.com/python/cpython/commit/ef5305819ff9b283d92dbf004f977592f4e64165
msg406665 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-20 15:55
There was a little discussion on GH-23230 whether the change should also go to 3.10 and 3.9 given it's not a bugfix. 

Eric unearthed a similar discussion here:
https://bugs.python.org/issue13952#msg152752

where R. David opted for skipping backports on the grounds that the change is a new feature. Given R. David's conservative approach (which I share), I merged this change to 3.11 alone. Unless a backwards incompatibility is demonstrated, we won't be backporting to 3.10 and 3.9.
msg406666 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-20 15:55
Thanks for pursuing this, Eric! ✨ 🍰 ✨
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86324
2021-11-20 15:55:43lukasz.langasetstatus: open -> closed
versions: + Python 3.11, - Python 3.9, Python 3.10
messages: + msg406666

resolution: fixed
stage: patch review -> resolved
2021-11-20 15:55:19lukasz.langasetmessages: + msg406665
2021-11-20 15:52:13miss-islingtonsetpull_requests: + pull_request27906
2021-11-20 15:52:09miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request27905
2021-11-20 15:52:07lukasz.langasetnosy: + lukasz.langa
messages: + msg406664
2020-11-10 17:41:32DylanVanAsschesetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request22126
2020-11-03 18:52:36eric.araujosetversions: - Python 3.6, Python 3.7, Python 3.8
nosy: + eric.araujo

messages: + msg380291

stage: needs patch
2020-10-26 18:11:11DylanVanAsschesetmessages: + msg379677
2020-10-26 18:03:00DylanVanAsschesettitle: http.server MIME type doesn't guess n-quads, n-triples, notation3 and TriG MIME types -> http.server doesn't guess n-quads, n-triples, notation3 and TriG MIME types
2020-10-26 18:02:39DylanVanAsschesettitle: guess_format() MIME type doesn't guess n-quads, n-triples, notation3 and TriG -> http.server MIME type doesn't guess n-quads, n-triples, notation3 and TriG MIME types
2020-10-26 17:56:56DylanVanAsschecreate