diff --git a/scripts/hf-fetch.sh b/scripts/hf-fetch.sh index 62ad2d3..2697d41 100755 --- a/scripts/hf-fetch.sh +++ b/scripts/hf-fetch.sh @@ -62,8 +62,12 @@ fetch_one() { echo " refetch $name (have $cur_size, want $size)" fi - # resumable download; -f fails on HTTP error so a 401/403 is not written as a file - curl -fsSL -C - -K "$auth_file" -o "$path" "$url" + # Resumable download; -f fails on HTTP error so a 401/403 is not written as a file. + # -C - only when a non-empty partial exists: with a missing file it sends + # Range: bytes=0-, which HF's xethub CDN rejects with 400 (xet-backed repos). + local resume_args=() + [[ -f "$path" && -s "$path" ]] && resume_args=(-C -) + curl -fsSL "${resume_args[@]}" -K "$auth_file" -o "$path" "$url" # verify byte count local got