Skip to content

Commit

Permalink
fix: fetch filename
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Nov 29, 2023
1 parent 1594f09 commit c0a0ac1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/download/stream-progress/fast-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ export default class FastDownload implements IStreamProgress {
if (!contentDispositionHeader)
return defaultFilename;

const {parameters} = contentDisposition.parse(contentDispositionHeader);
return parameters.filename ?? defaultFilename;
try {
const {parameters} = contentDisposition.parse(contentDispositionHeader);
return parameters.filename ?? defaultFilename;
} catch {
return defaultFilename;
}
}
}

0 comments on commit c0a0ac1

Please sign in to comment.