Revan0809 opened a new pull request, #698: URL: https://github.com/apache/shenyu-dashboard/pull/698
## Summary `src/utils/download.js` already checks for an `attachment` Content-Disposition header before saving the response body as a file, but it never special-cased an expired/invalid session the way `request()` does. When the token had expired (or the export otherwise failed with a 401), the user would download a file containing the raw error JSON without the session-expired flow (`login/logout` dispatch) ever triggering. - `getDownloadErrorMessage()` now also dispatches `login/logout` and `global/resetPermission` when the response is an HTTP 401 or the parsed JSON body has `code: 401`, matching the existing 401 handling in `request.js` (`src/utils/request.js:130-140`). - The thrown error message is unchanged (still prefers `result.message` from the body), so existing error-surfacing behavior for callers is preserved. Note: the non-401 part of this issue (downloading raw error JSON as a file instead of surfacing an error) was already fixed by #661 on `master`, so this PR only adds the missing 401 session-expiry handling. Fixes #620 ## Test plan - [x] `npm run test:unit -- src/utils/download.test.js` — 6/6 pass, including 2 new tests asserting `store.dispatch` is called with `login/logout` and `global/resetPermission` on both an HTTP-level 401 and an HTTP-200-with-`code:401` Admin error, and asserting dispatch is *not* called for other error codes (601, 500) - [x] `npx eslint --ext .js src/utils/download.js src/utils/download.test.js` — no new issues (pre-existing CRLF/prettier warnings on this Windows checkout are unrelated to this change and present repo-wide) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
