-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix issue 12769 mimetypes windows error #13183
base: main
Are you sure you want to change the base?
Fix issue 12769 mimetypes windows error #13183
Conversation
…egistry key inside `HKEY_CLASSES_ROOT` can't be accessed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
Thank you for taking on this issue. I took a look at your PR. It's on the right track, but I think it's actually a bit too detailed. Let me know what you think.
Co-authored-by: Richard Si <[email protected]>
Co-authored-by: Richard Si <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look at confirming this fix on Windows when I have time, but this looks good as is. Thanks!
@@ -0,0 +1 @@ | |||
Gracefully handle Windows registry access errors while guessing the MIME type of a file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for other reviewers, while the code comment is more general because it seems guess_type() can fail on any platform (according to the docs), the only reports in practice are on Windows w/ the registry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... I broke my Windows install while messing in the Registry Editor. Thankfully I had a system restore point so it wasn't a huge deal. I've double checked that the logic degrades gracefully when hard-coding an error, but I'm not going to try to reproduce the actual PermissionError :)
Fixes #12769 by ignoring the error
mimetypes
raises and keepingcontent_type
asNone
.The only function referencing this variable is
unpack_url(...)
callingunpack_file()
which already acceptsNone
as the content type as is.