mirror of
https://github.com/misskey-dev/media-proxy.git
synced 2025-04-29 10:57:30 +09:00
Content-Dispositionのパースでエラーが発生した場合にもダウンロードが完了するように
This commit is contained in:
parent
384c51569f
commit
99f0160e17
@ -82,10 +82,14 @@ export async function downloadUrl(url: string, path: string, settings:DownloadCo
|
|||||||
|
|
||||||
const contentDisposition = res.headers['content-disposition'];
|
const contentDisposition = res.headers['content-disposition'];
|
||||||
if (contentDisposition != null) {
|
if (contentDisposition != null) {
|
||||||
|
try {
|
||||||
const parsed = parse(contentDisposition);
|
const parsed = parse(contentDisposition);
|
||||||
if (parsed.parameters.filename) {
|
if (parsed.parameters.filename) {
|
||||||
filename = parsed.parameters.filename;
|
filename = parsed.parameters.filename;
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Failed to parse content-disposition: ${contentDisposition}\n${e}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).on('downloadProgress', (progress: Got.Progress) => {
|
}).on('downloadProgress', (progress: Got.Progress) => {
|
||||||
if (progress.transferred > settings.maxSize) {
|
if (progress.transferred > settings.maxSize) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user