From c1b680eeb417a5ff621aac4d9dc01583ff41c1a4 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 18 Mar 2019 14:07:10 -0700 Subject: [PATCH] Skip URLs that include the @ symbol when generating links Thanks to mcsim for the bug report. --- ts/components/conversation/Linkify.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ts/components/conversation/Linkify.tsx b/ts/components/conversation/Linkify.tsx index a845f7f420..200a156bc6 100644 --- a/ts/components/conversation/Linkify.tsx +++ b/ts/components/conversation/Linkify.tsx @@ -14,6 +14,7 @@ interface Props { } const SUPPORTED_PROTOCOLS = /^(http|https):/i; +const HAS_AT = /@/; export class Linkify extends React.Component { public static defaultProps: Partial = { @@ -50,7 +51,11 @@ export class Linkify extends React.Component { } const { url, text: originalText } = match; - if (SUPPORTED_PROTOCOLS.test(url) && !isLinkSneaky(url)) { + if ( + SUPPORTED_PROTOCOLS.test(url) && + !isLinkSneaky(url) && + !HAS_AT.test(url) + ) { results.push( {originalText}