Skip to content

[6.x] Handle download responses in Inertia requests#15050

Merged
jasonvarga merged 1 commit into
6.xfrom
inertia-downloads
Jul 22, 2026
Merged

[6.x] Handle download responses in Inertia requests#15050
jasonvarga merged 1 commit into
6.xfrom
inertia-downloads

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where utilities registered with a custom controller action that returns a download wouldn't work — clicking the utility in the Control Panel did nothing.

This was happening because Control Panel links are Inertia visits, and download responses (StreamedResponse / BinaryFileResponse) have no content for Inertia to work with, so Inertia's middleware treated them as "empty responses" and redirected back to the previous page.

This PR fixes it by overriding onEmptyResponse in the HandleInertiaRequests middleware, so download responses return Inertia::location() instead. This triggers a full browser visit, allowing the browser to handle the download natively.

Fixes #14751

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit 0f68656 into 6.x Jul 22, 2026
23 checks passed
@jasonvarga
jasonvarga deleted the inertia-downloads branch July 22, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Utilities can't process a download with only a controller

2 participants