Skip to content

[6.x] Fix backup downloads#18792

Merged
brandonkelly merged 5 commits into6.xfrom
brian/cms-1903-download-button-on-backups-utility-is-broken
May 6, 2026
Merged

[6.x] Fix backup downloads#18792
brandonkelly merged 5 commits into6.xfrom
brian/cms-1903-download-button-on-backups-utility-is-broken

Conversation

@brianjhanson
Copy link
Copy Markdown
Contributor

Fixes backup downloads

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 5, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  resources/js/components/utilities/DatabaseBackup.vue  29% smaller
  resources/js/composables/useCraftData.ts  0% smaller
  resources/translations/en/app.php Unsupported file format
  src/Http/Controllers/Utilities/DbBackupController.php Unsupported file format
  src/Http/Middleware/HandleInertiaRequests.php Unsupported file format

@brianjhanson brianjhanson requested a review from riasvdv May 5, 2026 14:52
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes database backup downloads in the Craft CP Inertia UI by ensuring download requests are handled as real file downloads (rather than XHR/Inertia responses), and by aligning the controller response behavior with the CP’s flash-message conventions.

Changes:

  • Share CSRF token name/value via the Inertia middleware so native form posts can include a valid CSRF input.
  • Update the DB backup utility UI to submit natively when downloading (and use Inertia form posting only for non-download flows).
  • Refactor DbBackupController to use RespondsWithFlash for success/failure responses and to parse the download flag via $request->boolean().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/Http/Middleware/HandleInertiaRequests.php Adds CSRF token name/value to shared Inertia craft props for use by native form submissions.
src/Http/Controllers/Utilities/DbBackupController.php Switches error/success handling to RespondsWithFlash and uses boolean request parsing for downloadBackup.
resources/js/composables/useCraftData.ts Extends the CraftData TypeScript interface to include CSRF token name/value.
resources/js/components/utilities/DatabaseBackup.vue Uses a Vue wrapper checkbox + native form submission for downloads, and injects a CSRF hidden input.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Http/Middleware/HandleInertiaRequests.php
Comment thread src/Http/Controllers/Utilities/DbBackupController.php Outdated
Comment thread src/Http/Controllers/Utilities/DbBackupController.php Outdated
Comment thread resources/js/composables/useCraftData.ts
Comment thread resources/js/components/utilities/DatabaseBackup.vue Outdated
brianjhanson and others added 4 commits May 5, 2026 10:20
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…oken' of github.com:craftcms/cms into brian/cms-1903-download-button-on-backups-utility-is-broken
@brandonkelly brandonkelly merged commit 79c2458 into 6.x May 6, 2026
16 checks passed
@brandonkelly brandonkelly deleted the brian/cms-1903-download-button-on-backups-utility-is-broken branch May 6, 2026 13:48
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.

4 participants