From 85212051d0e98edbf878497bc31735a503bb83e8 Mon Sep 17 00:00:00 2001 From: Flummi Date: Sun, 2 Jul 2023 13:11:11 +0200 Subject: [PATCH] small bugfix --- src/inc/trigger/parser.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/inc/trigger/parser.mjs b/src/inc/trigger/parser.mjs index 3b153ce..3bb442f 100644 --- a/src/inc/trigger/parser.mjs +++ b/src/inc/trigger/parser.mjs @@ -23,10 +23,9 @@ 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); - + if(links.length === 0) return false; @@ -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}`, {