diff --git a/backend/src/plugins/Automod/triggers/matchAttachmentType.ts b/backend/src/plugins/Automod/triggers/matchAttachmentType.ts index 37bb2053..308e0c8b 100644 --- a/backend/src/plugins/Automod/triggers/matchAttachmentType.ts +++ b/backend/src/plugins/Automod/triggers/matchAttachmentType.ts @@ -37,9 +37,16 @@ export const MatchAttachmentTypeTrigger = automodTrigger()({ const attachments: any[] = context.message.data.attachments; for (const attachment of attachments) { - const attachmentType = attachment.filename.split(`.`).pop(); + const attachmentType = attachment.filename + .split(".") + .pop() + .toLowerCase(); - if (trigger.blacklist_enabled && trigger.filetype_blacklist.includes(attachmentType)) { + const blacklist = trigger.blacklist_enabled + ? (trigger.filetype_blacklist || []).map(_t => _t.toLowerCase()) + : null; + + if (blacklist && blacklist.includes(attachmentType)) { return { extra: { matchedType: attachmentType, @@ -48,7 +55,11 @@ export const MatchAttachmentTypeTrigger = automodTrigger()({ }; } - if (trigger.whitelist_enabled && !trigger.filetype_whitelist.includes(attachmentType)) { + const whitelist = trigger.whitelist_enabled + ? (trigger.filetype_whitelist || []).map(_t => _t.toLowerCase()) + : null; + + if (whitelist && !whitelist.includes(attachmentType)) { return { extra: { matchedType: attachmentType,