diff --git a/libs/ui/elements/src/lib/metadata-info/linkify.directive.spec.ts b/libs/ui/elements/src/lib/metadata-info/linkify.directive.spec.ts index 541c624526..b2ee24948f 100644 --- a/libs/ui/elements/src/lib/metadata-info/linkify.directive.spec.ts +++ b/libs/ui/elements/src/lib/metadata-info/linkify.directive.spec.ts @@ -51,6 +51,10 @@ const testingUrls = [ 'Thirteenth link http://foo.com/(something)?after=parens query params', 'http://foo.com/(something)?after=parens', ], + [ + 'Fourteenth link (http://foo.com/blah) in parenthesis', + 'http://foo.com/blah', + ], ] const testWithMultipleUrls = { diff --git a/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts b/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts index 24cbb95636..6c0bcaa7d1 100644 --- a/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts +++ b/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts @@ -40,9 +40,9 @@ export class GnUiLinkifyDirective implements OnInit { if (url) { displayValue = this.createLink(displayValue, url) } else { - const urlRegex = /\bhttps?:\/\/\S+\b[=)/]?/g - const matches = displayValue.match(urlRegex) + const urlRegex = /\bhttps?:\/\/(?:\([^\s()]+\)|[^\s()]+)+/g + const matches = displayValue.match(urlRegex) if (matches && matches.length > 0) { matches.forEach((match) => { url = match