From 403d2ffef791b998926f19bee041fb73d4499652 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Thu, 24 Jun 2021 19:40:30 -0400 Subject: [PATCH] Fix AttributeError on hash mismatch This replaces the AttributeError reported in #4085 with the proper exception. --- poetry/installation/executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/poetry/installation/executor.py b/poetry/installation/executor.py index 4580656c933..493e7f515ca 100644 --- a/poetry/installation/executor.py +++ b/poetry/installation/executor.py @@ -679,8 +679,9 @@ def _download_link(self, operation: Union[Install, Update], link: Link) -> Link: ).hash() ) if archive_hash not in {f["hash"] for f in package.files}: + filename = archive.filename if isinstance(archive, Link) else archive raise RuntimeError( - f"Invalid hash for {package} using archive {archive.name}" + f"Invalid hash for {package} using archive {filename}" ) self._hashes[package.name] = archive_hash