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

Fix issue 12769 mimetypes windows error #13183

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JoaStuart
Copy link

Fixes #12769 by ignoring the error mimetypes raises and keeping content_type as None.

The only function referencing this variable is unpack_url(...) calling unpack_file() which already accepts None as the content type as is.

…egistry key inside `HKEY_CLASSES_ROOT` can't be accessed
Copy link
Member

@ichard26 ichard26 left a 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.

news/12769.bugfix.rst Outdated Show resolved Hide resolved
src/pip/_internal/operations/prepare.py Outdated Show resolved Hide resolved
@JoaStuart JoaStuart requested a review from ichard26 January 27, 2025 13:56
Copy link
Member

@ichard26 ichard26 left a 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.
Copy link
Member

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.

Copy link
Member

@ichard26 ichard26 left a 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 :)

@ichard26 ichard26 added this to the 25.1 milestone Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip install Windows registry error Access is denied
2 participants