File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Inject , Injectable } from '@angular/core' ;
22import { NativeWindowRef , NativeWindowService } from './window.service' ;
3+ import { isEmpty } from '../../shared/empty.util' ;
34
45/**
56 * LinkService provides utility functions for working with links, such as checking if a link is internal
@@ -22,6 +23,10 @@ export class InternalLinkService {
2223 * @returns A boolean indicating whether the link is internal.
2324 */
2425 public isLinkInternal ( link : string ) : boolean {
26+ if ( isEmpty ( this . currentURL ) ) {
27+ return false ;
28+ }
29+
2530 // Create a Domain object for the provided link
2631 const currentDomain = new URL ( this . currentURL ) . hostname ;
2732
@@ -39,6 +44,9 @@ export class InternalLinkService {
3944 * @returns The relative path for the given internal link.
4045 */
4146 public getRelativePath ( link : string ) : string {
47+ if ( isEmpty ( this . currentURL ) ) {
48+ return link ;
49+ }
4250 // Create a Domain object for the provided link
4351 const currentDomain = new URL ( this . currentURL ) . hostname ;
4452
You can’t perform that action at this time.
0 commit comments