From 05271d2678a2a4fb1f3de41ee089bade75b746ee Mon Sep 17 00:00:00 2001 From: didinele Date: Fri, 19 Jul 2024 21:13:37 +0300 Subject: [PATCH] fix(purge): proper url check for attachments --- services/interactions/src/handlers/mod.ts | 2 +- services/interactions/src/handlers/purge.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/interactions/src/handlers/mod.ts b/services/interactions/src/handlers/mod.ts index ad2ba4d8..d6313827 100644 --- a/services/interactions/src/handlers/mod.ts +++ b/services/interactions/src/handlers/mod.ts @@ -113,7 +113,7 @@ export default class ModHandler implements HandlerModule a.url.endsWith(`.${ext}`))); + return message.attachments.some((attachment) => new URL(attachment.url).pathname.endsWith(`.${ext}`)); }; const gifExt = ['gif', 'apng']; @@ -187,7 +187,7 @@ export default class PurgeHandler implements HandlerModule 0) { + if (!allExt.some(checkForExtension) && !message.embeds.length) { return false; }