Commit 000f974b authored by Brian Curtin's avatar Brian Curtin

Fix #10162: Add try/except around _winreg.OpenKey for keys that are

unreadable by all users, e.g., Flash, Silverlight, and Java keys were
causing errors.

We don't currently have a way to grant/deny permissions for a key
via winreg so there are no tests for this.
parent 28928aef
...@@ -253,14 +253,16 @@ class MimeTypes: ...@@ -253,14 +253,16 @@ class MimeTypes:
with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
r'MIME\Database\Content Type') as mimedb: r'MIME\Database\Content Type') as mimedb:
for ctype in enum_types(mimedb): for ctype in enum_types(mimedb):
with _winreg.OpenKey(mimedb, ctype) as key: try:
try: with _winreg.OpenKey(mimedb, ctype) as key:
suffix, datatype = _winreg.QueryValueEx(key, 'Extension') try:
except EnvironmentError: suffix, datatype = _winreg.QueryValueEx(key,
continue 'Extension')
if datatype != _winreg.REG_SZ: except EnvironmentError:
continue continue
self.add_type(ctype, suffix, strict) if datatype != _winreg.REG_SZ:
continue
self.add_type(ctype, suffix, strict)
def guess_type(url, strict=True): def guess_type(url, strict=True):
......
...@@ -43,6 +43,9 @@ Core and Builtins ...@@ -43,6 +43,9 @@ Core and Builtins
Library Library
------- -------
- Issue #10163: Skip unreadable registry keys during mimetypes
initialization.
- logging: Made StreamHandler terminator configurable. - logging: Made StreamHandler terminator configurable.
- logging: Allowed filters to be just callables. - logging: Allowed filters to be just callables.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment