Skip to content

Commit 28d5c00

Browse files
authored
Hash metadata as bytes (#9049)
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.
1 parent 7bf0ee7 commit 28d5c00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/poetry/repositories/http_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _get_info_from_metadata(self, link: Link) -> PackageInfo | None:
169169
)
170170
):
171171
metadata_hash = getattr(hashlib, hash_name)(
172-
response.text.encode()
172+
response.content
173173
).hexdigest()
174174
if metadata_hash != link.metadata_hashes[hash_name]:
175175
self._log(

0 commit comments

Comments
 (0)