Skip to content

Commit

Permalink
fix parsing of file extension in match_attachment_type trigger (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx authored Dec 27, 2023
1 parent d162418 commit 047ab87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/plugins/Automod/triggers/matchAttachmentType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { escapeInlineCode, Snowflake } from "discord.js";
import * as t from "io-ts";
import { extname } from "path";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";

Expand Down Expand Up @@ -33,7 +34,7 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
}

for (const attachment of context.message.data.attachments) {
const attachmentType = attachment.url.split(".").pop()!.toLowerCase();
const attachmentType = extname(new URL(attachment.url).pathname).slice(1).toLowerCase();

const blacklist = trigger.blacklist_enabled
? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase())
Expand Down

0 comments on commit 047ab87

Please sign in to comment.