fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly (#17291) - #17513
fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly (#17291)#17513waterWang wants to merge 1 commit into
Conversation
Contributor License AgreementHey @waterWang! Thank you for your contribution to Filigran! Before we can merge this pull request, we need you to sign our Contributor License Agreement (CLA). Why do we need a CLA?The CLA helps protect both you and Filigran. It ensures that:
How to signYou can sign the CLA using either of these methods:
Once signed, this comment will be automatically updated. ❌ CLA not signed yet This is an automated message from the Filigran CLA Bot. If you have questions, please contact the maintainers. |
|
🤖 [AI-generated] Hey @waterWang! 👋 Thanks a lot for opening PR #17513 — really appreciate the fix, and welcome to the OpenCTI community! 🙏 I just had a quick look and I think the description could be enhanced a little to help reviewers get through it faster. I haven't changed anything in your description — just a gentle suggestion: Area: How to test this PR 💡 If helpful, the CONTRIBUTING.md guide and PR template walk through what to include. No rush at all — thanks again for contributing to the project! 🚀 |
There was a problem hiding this comment.
Pull request overview
Fixes document/file downloads when the UI is deployed under a non-root APP_BASE_PATH by changing the navigation mechanism used by the file download handler.
Changes:
- Updated
FileLine’shandleLinknavigation fromwindow.location.pathname = urltowindow.location.href = urlto correctly resolve absolute/relative URLs under a router basename / base path.
Fixes #17291
Problem
When APP_BASE_PATH is configured, clicking download on a document creates a URL with a duplicated base path (e.g., /opencti_dev/opencti_dev/storage/get/...), causing the download to fail.
Root Cause
The handleLink function in FileLine.tsx used window.location.pathname = url to navigate, which doesn't handle the base path correctly.
Fix
Changed window.location.pathname = url to window.location.href = url, which correctly handles both absolute and relative URLs.