Skip to content

Commit 0f55ffd

Browse files
committed
fix(cli+sdk): raise error when content-length header is missing for artifact download
1 parent fe24cc9 commit 0f55ffd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

cli/kleinkram/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ def download_artifact(
116116
kleinkram.api.file_transfer._get_filename_from_cd(headers.get("content-disposition")) or f"{execution_id}.tar.gz",
117117
)
118118

119-
total_length = int(headers.get("content-length", 0))
119+
total_length_raw = headers.get("content-length")
120+
if total_length_raw is None:
121+
raise ValueError(
122+
f"Cannot determine artifact size for execution {execution_id}: "
123+
"the server did not return a content-length header."
124+
)
125+
total_length = int(total_length_raw)
120126

121127
filepath = Path(filename)
122128

0 commit comments

Comments
 (0)