Fix: file downloads fail with 401 when basic auth is enabled#125
Open
Fix: file downloads fail with 401 when basic auth is enabled#125
Conversation
When basic auth is enabled, the downloadObject method in FileContextMenu created a direct <a> link to the API endpoint. Browser-initiated downloads via <a> links do not include custom Authorization headers, causing 401 errors (especially in Chrome). This changes the download to use apiHandler.downloadFile() which goes through the Axios instance with proper auth headers already configured, then creates a temporary blob URL for the browser download. Fixes #63
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
r2-explorer-docs | 015693e | Commit Preview URL Branch Preview URL |
Feb 20 2026, 08:57 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #63
downloadObject()method created a raw<a>element pointing directly at the API URL — browser-initiated downloads via<a>links don't include custom HTTP headers, so theAuthorization: Basicheader was never sentChanges
<a>link download with an authenticated fetch usingapiHandler.downloadFile()(which goes through the Axios instance with auth headers)Test plan
🤖 Generated with Claude Code