Skip to content

Commit a079011

Browse files
author
Richard Gigan
committed
fix(GeneralHelper) : fix performance problem with regEx method "toRelativeUrl"
1 parent c3c9c60 commit a079011

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/utilities/GeneralHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ export const toRelativeUrl = (absoluteUrl: string): string => {
367367
if (!absoluteUrl) {
368368
return '';
369369
}
370-
371-
return absoluteUrl.replace(/^(?:\/\/|[^/]+)*\//, '/');
370+
const relativeUrl: string = new URL(absoluteUrl).pathname;
371+
return relativeUrl;
372372
};
373373

374374
export function sortString(a: string, b: string, isDesc: boolean): number {

0 commit comments

Comments
 (0)