usemagpie.ai/files/<tag>/<name> answered every Range with 206 and
"Content-Range: bytes NaN-NaN/<size>". R2 returns the served range with all
three keys (offset, length, suffix), the unasked ones undefined, and files.js
took `"suffix" in range` as "a suffix range", so size - undefined was NaN.
The same on the real bucket before the fix: bytes=1024-2047, bytes=-100 and
bytes=100- all gave NaN-NaN. files.js now reads a key only when it is a
number, and a range it can't state goes to GitHub's own address.
The updater resumes with "Range: bytes=<have>-" and accepts a 206 only when
Content-Range starts at <have>; any other 206 fell to the default case and
ended the update with "download ...: 206 Partial Content" (28 times in three
days for the reporter). It now throws away what was kept and asks once for
the whole file, as it already does for a 416.
Run (mote, at this tree): node --test site/*.test.mjs 115 pass; go test
./internal/update ok; go vet darwin/linux/windows ./internal/update clean;
gofmt -l clean. r2stub.mjs now returns the range as R2 does (undefined
keys); the new files.test.mjs assertions (1-3, -100, 0-, 8-99) fail on the
old files.js with "bytes NaN-NaN/10", and TestDownloadBadContentRangeIsFetchedWhole
fails on the old update.go with "206 Partial Content". Not tried: a real
auto-update through the deployed worker (checked with curl after deploy).