Skip to content

Commit

Permalink
Fix?(server): Content-Dispositionのパースでエラーが発生した場合にもダウンロードが完了するように
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaina authored and na2na-p committed May 10, 2023
1 parent 66c9c62 commit a95524c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/backend/src/core/DownloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ export class DownloadService {

const contentDisposition = res.headers['content-disposition'];
if (contentDisposition != null) {
const parsed = parse(contentDisposition);
if (parsed.parameters.filename) {
filename = parsed.parameters.filename;
try {
const parsed = parse(contentDisposition);
if (parsed.parameters.filename) {
filename = parsed.parameters.filename;
}
} catch (e) {
this.logger.warn(`Failed to parse content-disposition: ${contentDisposition}`, { stack: e });
}
}
}).on('downloadProgress', (progress: Got.Progress) => {
Expand Down

0 comments on commit a95524c

Please sign in to comment.