-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Windows 10 Mimetypes for .webp return empty #128703
Comments
Can you check the value of mimetypes intentionally prefers the system database, so if you've installed something that modified your system, then you would expect to see the changes. FWIW, my own machines specify |
Right, so something has registered the type incorrectly. There isn't really any easy way to find out who did it, but deleting the empty |
yes that should fix the problem, but how if the extension has no or even it has no wouldn't it be better to check for empty value, if yes then do not overwrite the original value of |
Python 3.12 on Ubuntu (fresh install)
update: Quick Fix for Python 3.12 or lower, locate the original path of
|
Ignoring empty values is a reasonable idea. PRs welcome from anyone (there's both Python and C versions of this code, IIRC). |
I will take a look at it later. If it's allowed, please leave it for me. |
yes that's right, problematic code Line 93 in 1153e66
I replace with if not type and ext in self.types_map[strict]:
type = self.types_map[strict][ext]
self.types_map[strict][ext] = type do you think it is good idea to also update another version? |
I think this is all I need, we should fix the bug first and then make some improvements to it later, but this requires more discussion. |
@ewwink Thank you for reporting the issue, and I appreciate the time you spent completing the code. To be precise, this is your achievement. So, thank you for giving me the opportunity :) |
Bug report
Bug description:
on Windows 10
guess_file_type()
checking.webp
file returntuple('', None)
nottuple('image/webp', None)
The problem is
db.read_windows_registry()
overwrite default types_map.webp = 'image/webp'
into.webp = ''
cpython/Lib/mimetypes.py
Lines 390 to 393 in 65da5db
CPython versions tested on:
3.11, 3.12, 3.13
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: