Since R2 will just read the rest of the file without throwing an error if the specified length is greater than the actual file size, these changes should be safe.
Oh I just realized, this will mean there is no pre-filled file when range is specified, so this breaks if-rangehere... Reverting for now, I'll try to fix it later when I have time
Edit: I fixed this here, thanks!
Since R2 will just read the rest of the file without throwing an error if the specified length is greater than the actual file size, these changes should be safe.