Skip to content

fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly (#17291) - #17513

Open
waterWang wants to merge 1 commit into
OpenCTI-Platform:masterfrom
waterWang:fix/download-url-base-path
Open

fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly (#17291)#17513
waterWang wants to merge 1 commit into
OpenCTI-Platform:masterfrom
waterWang:fix/download-url-base-path

Conversation

@waterWang

Copy link
Copy Markdown

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.

Copilot AI lite review requested due to automatic review settings August 4, 2026 19:15
@filigran-cla-bot filigran-cla-bot Bot added the cla:pending CLA signature required. label Aug 4, 2026
@filigran-cla-bot

Copy link
Copy Markdown

Contributor License Agreement

Hey @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:

  • You have the right to make this contribution
  • Filigran can use and distribute your contribution
  • Your contribution remains open source

How to sign

You can sign the CLA using either of these methods:

  1. 🔗 Sign directlyClick here to review and sign the CLA
  2. 📧 Via email — Check your inbox (and spam folder) for a signing invitation from Concord

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.

@Filigran-Automation Filigran-Automation changed the title fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly fix: use window.location.href instead of pathname to handle APP_BASE_PATH correctly (#17291) Aug 4, 2026
@Filigran-Automation Filigran-Automation added the community Contribution from the community. label Aug 4, 2026
@Filigran-Automation

Copy link
Copy Markdown
Member

🤖 [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
What could help: The template's "How to test this PR" section is missing entirely — there are no steps for a reviewer to reproduce the APP_BASE_PATH download issue and confirm the fix.
Suggestion: Add a short set of steps, e.g. "1. Configure APP_BASE_PATH (e.g. /opencti_dev). 2. Open a document and click Download. 3. Verify the URL is no longer duplicated and the file downloads correctly."

💡 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! 🚀

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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’s handleLink navigation from window.location.pathname = url to window.location.href = url to correctly resolve absolute/relative URLs under a router basename / base path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:pending CLA signature required. community Contribution from the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(frontend): OpenCTI UI cannot download documents when APP_BASE_PATH is defined

4 participants