Skip to content

Commit 52cb80c

Browse files
explain why we don't validate hexdigests now
1 parent f60e8b1 commit 52cb80c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/pip/_internal/models/link.py

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ class LinkHash:
4747
value: str
4848

4949
_hash_re = re.compile(
50+
# NB: we do not validate that the second group (.*) is a valid hex
51+
# digest. Instead, we simply keep that string in this class, and then check it
52+
# against Hashes when hash-checking is needed. This is easier to debug than
53+
# proactively discarding an invalid hex digest, as we handle incorrect hashes
54+
# and malformed hashes in the same place.
5055
r"({choices})=(.*)".format(
5156
choices="|".join(re.escape(hash_name) for hash_name in _SUPPORTED_HASHES)
5257
),

0 commit comments

Comments
 (0)