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:
1 parent
c5b55e1e3b
commit
441c4f1c99
1 file changed
+6
-2
+6
-2
@@ -62,8 +62,12 @@ fetch_one() {
|
|||||||
echo " refetch $name (have $cur_size, want $size)"
|
echo " refetch $name (have $cur_size, want $size)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# resumable download; -f fails on HTTP error so a 401/403 is not written as a file
|
# 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"
|
# -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
|
# verify byte count
|
||||||
local got
|
local got
|
||||||
|
|||||||
Reference in new issue
Block a user