aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
758 stars 127 forks source link

Bug: Byte ranges generated by XhrFileReader.js are invalid #177

Open robinfriedli opened 1 year ago

robinfriedli commented 1 year ago

The XhrFileReader defines the end of the byte range as such:

range[1] = Math.min(self._size, range[1]);

This is incorrect, because byte ranges are inclusive and should therefor always be lower than the size. It should:

range[1] = Math.min(self._size - 1, range[1]);

From mdn:

<range-end>
An integer in the given unit indicating the end position (zero-indexed & inclusive) of the requested range.

This may cause servers to reject the request with a 416