Show More
@@ -292,8 +292,13 b' class _lazymanifest(object):' | |||||
292 | b"Manifest values must be a tuple of (node, flags)." |
|
292 | b"Manifest values must be a tuple of (node, flags)." | |
293 | ) |
|
293 | ) | |
294 | hashval = value[0] |
|
294 | hashval = value[0] | |
295 | if not isinstance(hashval, bytes) or not 20 <= len(hashval) <= 22: |
|
295 | # hashes are either 20 or 32 bytes (sha1 or its replacement), | |
296 | raise TypeError(b"node must be a 20-byte byte string") |
|
296 | # and allow one extra byte taht won't be persisted to disk but | |
|
297 | # is sometimes used in memory. | |||
|
298 | if not isinstance(hashval, bytes) or not ( | |||
|
299 | 20 <= len(hashval) <= 22 or 32 <= len(hashval) <= 34 | |||
|
300 | ): | |||
|
301 | raise TypeError(b"node must be a 20-byte or 32-byte byte string") | |||
297 | flags = value[1] |
|
302 | flags = value[1] | |
298 | if len(hashval) == 22: |
|
303 | if len(hashval) == 22: | |
299 | hashval = hashval[:-1] |
|
304 | hashval = hashval[:-1] |
General Comments 0
You need to be logged in to leave comments.
Login now