Fix?(server): Content-Dispositionのパースでエラーが発生した場合にもダウンロードが完了するように

#10626
This commit is contained in:
tamaina 2023-04-15 11:18:47 +00:00
parent bcbf06ac8c
commit 38fdc73d01

View File

@ -86,10 +86,14 @@ export class DownloadService {
const contentDisposition = res.headers['content-disposition'];
if (contentDisposition != null) {
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) => {
if (progress.transferred > maxSize) {