Skip to content

Commit a858bb4

Browse files
authored
Fix regression in compute checksum. (#1067)
Should not be affected by the loadContents limit.
1 parent 819c81a commit a858bb4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cwltool/command_line_tool.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -706,14 +706,13 @@ def collect_output(self,
706706
if ll and ll != "no_listing":
707707
get_listing(fs_access, files, (ll == "deep_listing"))
708708
else:
709-
with fs_access.open(rfile["location"], "rb") as f:
710-
contents = b""
711-
if binding.get("loadContents") or compute_checksum:
712-
contents = content_limit_respected_read_bytes(f)
713-
if binding.get("loadContents"):
714-
files["contents"] = contents.decode("utf-8")
715-
if compute_checksum:
709+
if binding.get("loadContents"):
710+
with fs_access.open(rfile["location"], "rb") as f:
711+
files["contents"] = content_limit_respected_read_bytes(f).decode("utf-8")
712+
if compute_checksum:
713+
with fs_access.open(rfile["location"], "rb") as f:
716714
checksum = hashlib.sha1()
715+
contents = f.read(1024 * 1024)
717716
while contents != b"":
718717
checksum.update(contents)
719718
contents = f.read(1024 * 1024)

0 commit comments

Comments
 (0)