Skip to content

Commit

Permalink
Change range header to be inclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
mjishnu authored and Alfagun74 committed Jun 16, 2024
1 parent ede6ef4 commit 5d351f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/files/files.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ export class FilesService implements OnApplicationBootstrap {
fileSize: number,
): RangeHeader {
let rangeStart: number = 0;
let rangeEnd: number = fileSize;
let rangeEnd: number = fileSize - 1;

if (rangeHeader?.includes("-")) {
const [extractedStart, extractedEnd] = rangeHeader
Expand All @@ -688,14 +688,14 @@ export class FilesService implements OnApplicationBootstrap {
}
if (
!isNaN(extractedEnd) &&
extractedEnd > rangeStart &&
extractedEnd >= rangeStart &&
extractedEnd < fileSize
) {
rangeEnd = extractedEnd;
}
}

const rangeSize: number = rangeEnd - rangeStart;
const rangeSize: number = rangeEnd - rangeStart + 1;
return {
start: rangeStart,
end: rangeEnd,
Expand Down

0 comments on commit 5d351f4

Please sign in to comment.