bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)

https://bugs.python.org/issue22347
This commit is contained in:
Dong-hee Na 2019-09-05 09:34:35 +09:00 committed by Miss Islington (bot)
parent 6cd9666ce9
commit 87bd2071c7
4 changed files with 13 additions and 2 deletions

View file

@ -114,7 +114,8 @@ class MimeTypes:
but non-standard types.
"""
url = os.fspath(url)
scheme, url = urllib.parse._splittype(url)
p = urllib.parse.urlparse(url)
scheme, url = p.scheme, p.path
if scheme == 'data':
# syntax of data URLs:
# dataurl := "data:" [ mediatype ] [ ";base64" ] "," data