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 09f9b93ecd..b31630f0c9 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 @@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser' import { GnUiLinkifyDirective } from './linkify.directive' @Component({ - template: `
Click this link https://www.example.com
`, + template: `
Click this link https://www.example.com/
`, }) class TestComponent {} @@ -32,7 +32,7 @@ describe('GnUiLinkifyDirective', () => { const anchorElement = debugElement.query(By.css('a')) const href = anchorElement.nativeElement.getAttribute('href') - expect(href).toBe('https://www.example.com') + expect(href).toBe('https://www.example.com/') }) it('should have the target attribute set to "_blank"', () => { 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 0ae4289b10..c807d0947d 100644 --- a/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts +++ b/libs/ui/elements/src/lib/metadata-info/linkify.directive.ts @@ -30,7 +30,7 @@ export class GnUiLinkifyDirective implements OnInit { } private linkifyText(text: string): string { - return text.replace(/(\bhttps?:\/\/\S+\b)/g, (match) => { + return text.replace(/(\bhttps?:\/\/\S+\b\/?)/g, (match) => { return `${match} open_in_new` })