From d0a210644802b31b785c5b9c1b5a71deadef7cc1 Mon Sep 17 00:00:00 2001 From: Matt Rusiniak <528239+f0ff886f@users.noreply.github.com> Date: Mon, 18 Oct 2021 13:22:23 +0200 Subject: [PATCH] Fix file:// path handling on Windows --- poetry/core/packages/utils/link.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/poetry/core/packages/utils/link.py b/poetry/core/packages/utils/link.py index ae1319ce8..0b587257b 100644 --- a/poetry/core/packages/utils/link.py +++ b/poetry/core/packages/utils/link.py @@ -6,7 +6,7 @@ from typing import Optional from typing import Tuple -from .utils import path_to_url +from .utils import path_to_url, url_to_path from .utils import splitext @@ -102,7 +102,12 @@ def netloc(self) -> str: @property def path(self) -> str: - return urlparse.unquote(urlparse.urlsplit(self.url)[2]) + # Properly handle file:// paths https://github.com/python-poetry/poetry/issues/4163 + if self.url.startswith("file:"): + p = str(url_to_path(self.url)) + else: + p = urlparse.unquote(urlparse.urlsplit(self.url)[2]) + return p def splitext(self) -> Tuple[str, str]: return splitext(posixpath.basename(self.path.rstrip("/")))