Skip to content

Commit

Permalink
fix(chunks): generating chunks without range support
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Jul 5, 2024
1 parent d5aa490 commit 245f5ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class DownloadEngineFile extends EventEmitter<DownloadEngineFileE

protected _emptyChunksForPart(part: number) {
const partInfo = this.file.parts[part];
if (!partInfo.acceptRange) {
if (partInfo.size === 0) {
return [ChunkStatus.NOT_STARTED];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class DownloadEngineFetchStreamFetch extends BaseDownloadEngineFe
const acceptRange = this.options.acceptRangeIsKnown ?? response.headers.get("accept-ranges") === "bytes";
const fileName = parseContentDisposition(response.headers.get("content-disposition"));

let length = parseInt(response.headers.get("content-length")!);
let length = parseInt(response.headers.get("content-length")!) || 0;
if (response.headers.get("content-encoding") || browserCheck() && MIN_LENGTH_FOR_MORE_INFO_REQUEST < length) {
length = acceptRange ? await this.fetchDownloadInfoWithoutRetryContentRange(url) : 0;
}
Expand Down

0 comments on commit 245f5ab

Please sign in to comment.