Ignore mime type charset and other extra details in match_mime_type

This commit is contained in:
Dragory 2021-09-05 21:01:13 +03:00
parent 497d334b15
commit 70fb0b5baa
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -30,7 +30,8 @@ export const MatchMimeTypeTrigger = automodTrigger<MatchResultType>()({
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())