From 8bff4202c7cab13640ae27b92cdada152316be67 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:53:42 +0000 Subject: [PATCH] Fix path construction: use req.path directly for whitelist check Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- back/loaders/express.ts | 2 +- src/utils/http.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/back/loaders/express.ts b/back/loaders/express.ts index 1a933555..97aa3253 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -84,7 +84,7 @@ export default ({ app }: { app: Application }) => { } } - const originPath = `${config.baseUrl}${req.path === '/' ? '' : req.path}`; + const originPath = req.path; if ( !headerToken && originPath && diff --git a/src/utils/http.tsx b/src/utils/http.tsx index d0d03063..cdb026a7 100644 --- a/src/utils/http.tsx +++ b/src/utils/http.tsx @@ -92,7 +92,8 @@ const apiWhiteListBase = [ '/api/user/notification/init', ]; -const apiWhiteList = config.baseUrl +// Only modify paths if baseUrl is set and not the default '/' +const apiWhiteList = config.baseUrl && config.baseUrl !== '/' ? apiWhiteListBase.map(path => `${config.baseUrl}${path.replace(/^\//, '')}`) : apiWhiteListBase;