Skip to content

Commit 70679fa

Browse files
committed
Fix
Signed-off-by: laurentsimon <[email protected]>
1 parent 20c6c94 commit 70679fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

model_signing/serialize.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def _task_v2(task_info: any) -> bytes:
340340
# Only files are recorded.
341341
if ty != "file":
342342
raise ValueError(f"internal: got a non-file path {name}")
343-
343+
344344
return Hasher._node_file_compute_v1(name,
345345
b'', start_pos, end_pos, chunk)
346346

@@ -366,7 +366,7 @@ def _to_path_metadata(task_info: [any], all_hashes: bytes) -> [PathMetadata]:
366366
prev_name = curr_name
367367

368368
# Compute the digest for the last (unfinished) task.
369-
if prev_i < len(task_info):
369+
if prev_i < len(task_info) - 1:
370370
h = hashlib.sha256(bytes(all_hashes[prev_i:])).digest()
371371
paths += [PathMetadata(prev_name, Hashed(DigestAlgorithm.SHA256_P1, h))]
372372
# TODO: Test this function properly.

0 commit comments

Comments
 (0)