Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upInclude mime.types file and use it for WebUI Content-Types #1950
Conversation
Python 2.7 on Windows loads known MIME types from registry, which is not always up-to-date. For example, it causes issue with webp images: http://127.0.0.1:43110/Talk.ZeroNetwork.bit/?Topic:1554160326_131Seivv6aH8vnohPmYPcPwPfZ1a5ubMMs The mime.types file has been merged from Fedora's /etc/mime.types and https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.txt
|
I think it would be better more predictable not use mimetypes module, but add a simple module that parse handle mimetypes queries and parse the data file. |
|
@HelloZeroNet, why? mimetypes is a small module, it's included in standard Python library and already bundled&used in ZeroNet. |
|
@HelloZeroNet Any progress on this? |
|
I still think it would be easier/faster to include a small list of known popular filetypes without using the mimetypes module. For example: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types |
|
@HelloZeroNet What if program first checks some common MIME types from your list. If none of them matches, the program also checks |
|
It's also possible, but I think its better if it's does not depends on system settings, but works the same way on for every client. So if there is any problem related to content-type, then we can find the problem and reproduce it easier. |
|
@HelloZeroNet Are you aware that mimetypes module just loads my list and parses it, without using system mime types? Are you still want to replace it with a custom one? I don't understand the reason. |
|
I usually try to avoid using packages if I can do the same with a few lines of code to avoid unwanted side effects. |
|
Unfortunately I don't have much spare time recently. |
Python 2.7 on Windows loads known MIME types from registry, which is
not always up-to-date. For example, it causes issue with webp images:
http://127.0.0.1:43110/Talk.ZeroNetwork.bit/?Topic:1554160326_131Seivv6aH8vnohPmYPcPwPfZ1a5ubMMs
The mime.types file has been merged from Fedora's /etc/mime.types and
https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.txt