From 70fb0b5baa7b35d1529ba794d88b3bbb4359bd3e Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 5 Sep 2021 21:01:13 +0300 Subject: [PATCH] Ignore mime type charset and other extra details in match_mime_type --- backend/src/plugins/Automod/triggers/matchMimeType.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Automod/triggers/matchMimeType.ts b/backend/src/plugins/Automod/triggers/matchMimeType.ts index f38bb8fa..5e00d4b6 100644 --- a/backend/src/plugins/Automod/triggers/matchMimeType.ts +++ b/backend/src/plugins/Automod/triggers/matchMimeType.ts @@ -30,7 +30,8 @@ export const MatchMimeTypeTrigger = automodTrigger()({ if (!attachments) return null; for (const attachment of attachments) { - const { contentType } = attachment; + const { contentType: rawContentType } = attachment; + const contentType = (rawContentType || "").split(";")[0]; // Remove "; charset=utf8" and similar from the end const blacklist = trigger.blacklist_enabled ? (trigger.mime_type_blacklist ?? []).map(_t => _t.toLowerCase())