소스 검색

Remove duplicated URL in error notification

Fixes an issue where the relative path of an URL may appear duplicated
when a request gives an error.

Replaces the deprecated `substr` with `substring`.
Sergiu Miclea 3 년 전
부모
커밋
1beb54039a
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      src/utils/ApiCallerHandlers.ts

+ 1 - 2
src/utils/ApiCallerHandlers.ts

@@ -9,9 +9,8 @@ const isOnLoginPage = (): boolean =>
 const truncateUrl = (url: string): string => {
   const MAX_LENGTH = 100;
   let relativePath = url.replace(/http(s)?:\/\/.*?\//, "/");
-  relativePath += relativePath;
   if (relativePath.length > MAX_LENGTH) {
-    relativePath = `${relativePath.substr(0, MAX_LENGTH)}...`;
+    relativePath = `${relativePath.substring(0, MAX_LENGTH)}...`;
   }
   return relativePath;
 };