mirror of
https://github.com/misskey-dev/media-proxy.git
synced 2025-04-29 02:47:26 +09:00
Content-Dispositionのパースでエラーが発生した場合にもダウンロードが完了するように
This commit is contained in:
parent
384c51569f
commit
99f0160e17
@ -82,9 +82,13 @@ export async function downloadUrl(url: string, path: string, settings:DownloadCo
|
||||
|
||||
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) {
|
||||
console.log(`Failed to parse content-disposition: ${contentDisposition}\n${e}`);
|
||||
}
|
||||
}
|
||||
}).on('downloadProgress', (progress: Got.Progress) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user