From 0b45e6112c2b151e0faf58bccfff7540cd18f64b Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Mon, 21 Oct 2024 16:32:47 +0100 Subject: [PATCH] Drop all trailing punctuations from URLs in a pasted text This matches the common behaviour of various places, e.g. GitHub and Slack. --- client/src/components/Draftail/decorators/Link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Draftail/decorators/Link.js b/client/src/components/Draftail/decorators/Link.js index 5290be0d7c..f2763cf5e5 100644 --- a/client/src/components/Draftail/decorators/Link.js +++ b/client/src/components/Draftail/decorators/Link.js @@ -148,7 +148,7 @@ const insertContentWithLinks = (editorState, htmlOrText) => { // For example "Go to https://example.com." // Terminal Punctuation class: see https://www.unicode.org/review/pr-23.html. const cleanURLPattern = match[1].replace( - /\p{Terminal_Punctuation}$/u, + /\p{Terminal_Punctuation}+$/u, '', ); const url = getValidLinkURL(cleanURLPattern);