Skip to content

Commit

Permalink
Adjust byte range calculation in server request handler. Fixes a bug …
Browse files Browse the repository at this point in the history
…when listening audio.

This commit changes the calculation of the byte range to correctly extract the data. Rather than read up to 'end', it now reads the correct number of bytes, which is 'end - start + 1'. This correction ensures the right amount of data is read and processed.
  • Loading branch information
jmgeffroy committed Jan 20, 2024
1 parent a8d2980 commit c9a0381
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract class RequestHandler {
HttpHeaders.contentRangeHeader, 'bytes $start-$end/$length');

ByteData? data =
(await resource.read(range: IntRange(start, end))).getOrNull();
(await resource.read(range: IntRange(start, end - start + 1))).getOrNull();
if (data != null) {
await response.addStream(data.asStream());
}
Expand Down

0 comments on commit c9a0381

Please sign in to comment.