From 72b3d6b828c57a5385fe3ef7989f25e82aacf563 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:59:26 +0000 Subject: [PATCH] Fix links to users and communities not including query in hyperlink (#2368) Co-authored-by: SleeplessOne1917 --- lemmy-translations | 2 +- src/shared/config.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lemmy-translations b/lemmy-translations index 91563f22..6c03b403 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 91563f222284e19def549ac5247039b398c78931 +Subproject commit 6c03b403c79bc5a893527d1fe217690db774a7ef diff --git a/src/shared/config.ts b/src/shared/config.ts index 69039532..ec1f7e13 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -33,6 +33,8 @@ export const authCookieName = "jwt"; // page on route "/communities" export const communityLimit = 50; +const queryPairRegex = "[a-zA-Zd_-]+=[a-zA-Zd+-_]+"; + /** * Accepted formats: * !community@server.com @@ -40,7 +42,9 @@ export const communityLimit = 50; * /m/community@server.com * /u/username@server.com */ -export const instanceLinkRegex = - /(\/[cmu]\/|!)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g; +export const instanceLinkRegex = new RegExp( + `(/[cmu]/|!)[a-zA-Z\\d._%+-]+@[a-zA-Z\\d.-]+\\.[a-zA-Z]{2,}(?:/?\\?${queryPairRegex}(?:&${queryPairRegex})*)?`, + "g", +); export const testHost = "0.0.0.0:8536";