Skip to content

Commit

Permalink
Hash metadata as bytes (#9049)
Browse files Browse the repository at this point in the history
Because warehouse doesn't send a charset, this can get decoded as something
other than utf-8, which doesn't encode (as utf-8) back to the same bytes. For
hash purposes especially, just look at the original bytes.
  • Loading branch information
thatch authored Mar 2, 2024
1 parent 7bf0ee7 commit 28d5c00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/poetry/repositories/http_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _get_info_from_metadata(self, link: Link) -> PackageInfo | None:
)
):
metadata_hash = getattr(hashlib, hash_name)(
response.text.encode()
response.content
).hexdigest()
if metadata_hash != link.metadata_hashes[hash_name]:
self._log(
Expand Down

0 comments on commit 28d5c00

Please sign in to comment.