fix(assets): always chunk uploads in GalleryBrowser#45
Merged
Conversation
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)
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
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 theuploadChunkedutil already existed, but were only wired into a composable (useMediaManager.ts) that was never imported anywhere — orphan code.Changes
GalleryBrowser.vue— always uploads viauploadChunked(5MB chunks, octet-stream + Content-Range). One code path, no size-based branching.useMediaManager.ts— deleted (orphan, 193 lines).chunkedUpload.ts— droppedshouldUseChunkedUploadhelper (no longer referenced).Why not
useHttpfor chunksInertia v3's
useHttponly serializes bodies asmultipart/form-data(when files are present) orapplication/json— confirmed innode_modules/@inertiajs/vue3source (useHttp.ts:200-208). There's no path for rawapplication/octet-streambodies, which is what the chunked endpoint reads via$request->getContent().useHttpstays 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 existingstoreChunkedtests)/assetsand confirm it completes via multiple chunks (Network tab shows multiple POSTs to/assets/chunkedwithContent-Range)/assets— should still complete in a single chunk request🤖 Generated with Claude Code