From a12b1da11418c5dc3180885376b1d87b8db43f93 Mon Sep 17 00:00:00 2001 From: Joshua Pohl Date: Sun, 9 Aug 2020 12:40:43 -0500 Subject: [PATCH] fix: include generic accept header for compatibility with some podcast servers fixes #13 --- bin/util.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/util.js b/bin/util.js index 48e11be..c726f9b 100644 --- a/bin/util.js +++ b/bin/util.js @@ -230,6 +230,9 @@ let download = async ({ url, outputPath, key, archive, override }) => { timeout: 5000, method: "HEAD", responseType: "json", + headers: { + accept: "*/*", + }, }); let removeFile = () => { @@ -256,7 +259,12 @@ let download = async ({ url, outputPath, key, archive, override }) => { } let fileSize = fs.statSync(outputPath).size; - let expectedSize = parseInt(headResponse.headers["content-length"]); + let expectedSize = + headResponse && + headResponse.headers && + headResponse.headers["content-length"] + ? parseInt(headResponse.headers["content-length"]) + : 0; if (fileSize === 0) { removeFile();