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 file:// path handling on Windows #222

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions poetry/core/packages/utils/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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("/")))
Expand Down