summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorTomatoCake <60300461+DEVTomatoCake@users.noreply.github.com>2024-06-25 22:01:35 +0200
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2024-07-04 09:41:46 +1000
commit0ac8888d410a3d8cd172ffe4eb44ebeff1e416e2 (patch)
treea79582ead679a702cbf977b377324f7be694899d /src/api
parentSend position property on guild join (diff)
downloadserver-ts-0ac8888d410a3d8cd172ffe4eb44ebeff1e416e2.tar.xz
Don't embed links in <>
Diffstat (limited to 'src/api')
-rw-r--r--src/api/util/handlers/Message.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 6172a3d0c..85db26b27 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -51,7 +51,7 @@ const allow_empty = false; // TODO: embed gifs/videos/images const LINK_REGEX = - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g; + /<?https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)>?/g; export async function handleMessage(opts: MessageOptions): Promise<Message> { const channel = await Channel.findOneOrFail({ @@ -213,6 +213,9 @@ export async function postHandleMessage(message: Message) { const cachePromises = []; for (const link of links) { + // Don't embed links in <> + if (link.startsWith("<") && link.endsWith(">")) continue; + const url = new URL(link); const cached = await EmbedCache.findOne({ where: { url: link } });