Fix path construction: use req.path directly for whitelist check

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-22 14:53:42 +00:00
parent 0bae11def6
commit 8bff4202c7
2 changed files with 3 additions and 2 deletions

View File

@ -84,7 +84,7 @@ export default ({ app }: { app: Application }) => {
} }
} }
const originPath = `${config.baseUrl}${req.path === '/' ? '' : req.path}`; const originPath = req.path;
if ( if (
!headerToken && !headerToken &&
originPath && originPath &&

View File

@ -92,7 +92,8 @@ const apiWhiteListBase = [
'/api/user/notification/init', '/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.map(path => `${config.baseUrl}${path.replace(/^\//, '')}`)
: apiWhiteListBase; : apiWhiteListBase;