Fix downloadImage not returning 2 when content-type isn't image
All checks were successful
CI / CI (push) Successful in 1m24s
All checks were successful
CI / CI (push) Successful in 1m24s
This commit is contained in:
parent
f0e08eec13
commit
ca646fc5ee
1 changed files with 1 additions and 1 deletions
|
@ -84,7 +84,7 @@ module.exports = {
|
|||
async downloadImage(url, path) {
|
||||
const res = await fetch(url);
|
||||
if(!res.ok) return 1;
|
||||
if(!res.headers.get('content-type').startsWith("image")) 2;
|
||||
if(!res.headers.get('content-type').startsWith("image")) return 2;
|
||||
const stream = Readable.fromWeb(res.body)
|
||||
await writeFile(path, stream);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue