From efc978f3ceda96ac0ca767c4b3c2dd2224220f35 Mon Sep 17 00:00:00 2001 From: NickVeld Date: Mon, 2 Aug 2021 16:03:19 +0300 Subject: [PATCH] lib/nturl2path: in url2pathname raise error on several drive letters --- Lib/nturl2path.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py index 61852aff58912d..5705ea5f92a912 100644 --- a/Lib/nturl2path.py +++ b/Lib/nturl2path.py @@ -31,6 +31,9 @@ def url2pathname(url): if len(comp) != 2 or comp[0][-1] not in string.ascii_letters: error = 'Bad URL: ' + url raise OSError(error) + if len(comp[0]) > 1 and comp[0][-2] not in {"/", "\\"}: + error = 'Bad URL (too many drive letters [before the first | ]): ' + url + raise OSError(error) drive = comp[0][-1].upper() components = comp[1].split('/') path = drive + ':'