Skip to content

Commit

Permalink
fix: include generic accept header for compatibility with some podcas…
Browse files Browse the repository at this point in the history
…t servers

fixes #13
  • Loading branch information
lightpohl committed Aug 9, 2020
1 parent 09a1572 commit a12b1da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ let download = async ({ url, outputPath, key, archive, override }) => {
timeout: 5000,
method: "HEAD",
responseType: "json",
headers: {
accept: "*/*",
},
});

let removeFile = () => {
Expand All @@ -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();
Expand Down

0 comments on commit a12b1da

Please sign in to comment.