3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 00:35:02 +00:00

feat(automod): MIME type trigger validation

This commit is contained in:
Hiroyuki 2021-07-30 16:07:54 -04:00
parent 2af691b025
commit 774cfb321e
No known key found for this signature in database
GPG key ID: C15AC26538975A24

View file

@ -110,6 +110,21 @@ const configPreprocessor: ConfigPreprocessorFn<AutomodPluginType> = options => {
]);
}
}
if (triggerObj[triggerName].match_mime_type) {
const white = triggerObj[triggerName].match_mime_type.whitelist_enabled;
const black = triggerObj[triggerName].match_mime_type.blacklist_enabled;
if (white && black) {
throw new StrictValidationError([
`Cannot have both blacklist and whitelist enabled at rule <${rule.name}/match_mime_type>`,
]);
} else if (!white && !black) {
throw new StrictValidationError([
`Must have either blacklist or whitelist enabled at rule <${rule.name}/match_mime_type>`,
]);
}
}
}
}
}