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.
This commit is contained in:
Frank
2026-09-26 15:23:24 -07:00
parent c5b55e1e3b
commit 441c4f1c99
+6 -2
View File
@@ -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