Skip to content

fix(assets): always chunk uploads in GalleryBrowser#45

Merged
paulocastellano merged 1 commit into
mainfrom
fix/assets-chunked-upload
May 18, 2026
Merged

fix(assets): always chunk uploads in GalleryBrowser#45
paulocastellano merged 1 commit into
mainfrom
fix/assets-chunked-upload

Conversation

@paulocastellano
Copy link
Copy Markdown
Contributor

Summary

Uploads from /assets (and the media picker dialog inside the post editor, which reuses the same component) were posting files in a single multipart request. A 180MB video hit nginx/php-fpm's body limit and returned 413 after ~28s.

The chunked endpoint (AssetController::storeChunked) and the uploadChunked util already existed, but were only wired into a composable (useMediaManager.ts) that was never imported anywhere — orphan code.

Changes

  • GalleryBrowser.vue — always uploads via uploadChunked (5MB chunks, octet-stream + Content-Range). One code path, no size-based branching.
  • useMediaManager.ts — deleted (orphan, 193 lines).
  • chunkedUpload.ts — dropped shouldUseChunkedUpload helper (no longer referenced).

Why not useHttp for chunks

Inertia v3's useHttp only serializes bodies as multipart/form-data (when files are present) or application/json — confirmed in node_modules/@inertiajs/vue3 source (useHttp.ts:200-208). There's no path for raw application/octet-stream bodies, which is what the chunked endpoint reads via $request->getContent(). useHttp stays for the JSON flows (Unsplash / Giphy / save-from-url) in the same file.

Test plan

  • php artisan test --compact --filter=AssetControllerTest — 15/15 passing (includes the 4 existing storeChunked tests)
  • Manual: upload a >100MB video on /assets and confirm it completes via multiple chunks (Network tab shows multiple POSTs to /assets/chunked with Content-Range)
  • Manual: upload a small image on /assets — should still complete in a single chunk request
  • Manual: same two checks from inside the post editor's media picker

🤖 Generated with Claude Code

The /assets page (and the picker dialog that reuses GalleryBrowser)
posted files in a single multipart request, so anything past nginx /
php-fpm's body limit failed with 413. The chunked endpoint and util
already existed but were only wired into an orphan composable.

- GalleryBrowser now always uploads via uploadChunked
- Drop the orphan useMediaManager composable
- Drop shouldUseChunkedUpload (no longer referenced)
@paulocastellano paulocastellano merged commit a0861a0 into main May 18, 2026
2 checks passed
@paulocastellano paulocastellano deleted the fix/assets-chunked-upload branch May 18, 2026 23:04
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.

1 participant