From 4db858b0e74ef7ac66b4abdc8a1df9093001011c Mon Sep 17 00:00:00 2001 From: ModyQyW Date: Wed, 27 Dec 2023 10:04:02 +0800 Subject: [PATCH] fix: regular expression denial of service (ReDoS), axios/axios#6132 --- src/utils/combineUrls.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/combineUrls.ts b/src/utils/combineUrls.ts index 3f37003..f351b4c 100644 --- a/src/utils/combineUrls.ts +++ b/src/utils/combineUrls.ts @@ -1,5 +1,5 @@ export const combineUrls = (baseUrl: string, relativeUrl: string) => { return relativeUrl - ? baseUrl.replace(/\/+$/, '') + '/' + relativeUrl.replace(/^\/+/, '') + ? baseUrl.replace(/\/?\/$/, '') + '/' + relativeUrl.replace(/^\/+/, '') : baseUrl; };