small bugfix

This commit is contained in:
Flummi 2023-07-02 13:11:11 +02:00
parent f2757f08af
commit 85212051d0

View File

@ -23,7 +23,6 @@ export default async bot => {
f: e => {
const links = e.message.match(regex.all)?.filter(link => !link.includes(cfg.main.url)) || [];
let repost;
if(e.media)
links.push(e.media);
@ -65,11 +64,12 @@ export default async bot => {
ext = meta.ext;
} catch(err) {
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
ext = tmphead;
// this can be undefined for unsupported mime types, but will be caught in the general mime check below
ext = cfg.mimes[tmphead];
}
if(!Object.values(cfg.mimes).includes(ext.toLowerCase())) {
return await e.reply('mime schmime '+ext);
if(!Object.values(cfg.mimes).includes(ext?.toLowerCase())) {
return 'mime schmime ' + ext;
}
const msg = await e.reply(`[charging the f0cker] downloading: ${uuid}`, {