Copilot commented on code in PR #14054:
URL: https://github.com/apache/cloudstack/pull/14054#discussion_r3931828759
##########
ui/src/utils/request.js:
##########
@@ -51,7 +51,9 @@ const err = (error) => {
})
}
if (response.status === 401) {
- if (response.config && response.config.params && ['forgotPassword',
'listIdps', 'cloudianIsEnabled'].includes(response.config.params.command)) {
+ const requestCommand = (response.config && response.config.params &&
response.config.params.command) ||
+ (response.config && typeof response.config.data === 'string' && new
URLSearchParams(response.config.data).get('command'))
+ if (['forgotPassword', 'listIdps',
'cloudianIsEnabled'].includes(requestCommand)) {
Review Comment:
`requestCommand` is not extracted for the common POST case where `axios` is
called with `data: params` (a `URLSearchParams` instance, e.g.
`postAPI('forgotPassword', ...)`). In that scenario `typeof
response.config.data === 'string'` is false, so `requestCommand` becomes
undefined and the 401 handling won't skip notifications/redirect logic for the
allowlisted commands as intended.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]