From 441c4f1c9956442ad83ec6b9e52fe7d7768e865f Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 26 Sep 2026 15:23:24 -0700 Subject: [PATCH] hf-fetch: only pass -C - when a non-empty partial exists With a missing file, -C - sends Range: bytes=0-, which HF's xethub CDN rejects with 400. Xet-backed repos (e.g. Lucebox/DeepSeek-V4.1- Flash-ROCMFP23-GGUF) fail on the first fetch; the old LFS backend tolerated the zero-offset range. --- scripts/hf-fetch.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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