[13.x] Alternative: Allow later filesystem disks to override earlier …#59302
Open
sadique-cws wants to merge 1 commit intolaravel:13.xfrom
Open
[13.x] Alternative: Allow later filesystem disks to override earlier …#59302sadique-cws wants to merge 1 commit intolaravel:13.xfrom
sadique-cws wants to merge 1 commit intolaravel:13.xfrom
Conversation
f7feab0 to
6370c15
Compare
This was referenced Mar 20, 2026
…ones at the same serve URI
6370c15 to
0f79fa9
Compare
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.
Problem
When the framework merges base configuration with user configuration via LoadConfiguration, framework-default disks (like
local,s3) get deep-merged back into the user's disks array list even if they were intentionally excluded.If a user-defined disk (e.g.,
'private') uses the same driver and root options as the base default disk, both will haveserve => trueand no explicit url, causing both to claim the/storageURI.Previously, this condition threw: "The [private] disk conflicts with the [local] disk at [/storage]." This prevents users from defining their own served disks without assigning explicit unique URLs to default disks they don't even intend to use.
Solution
This fix leaves the config merging behavior as-is and addresses the safety limit in
FilesystemServiceProvider::serveFiles().It separates disk collection from route registration:
array_mergeplaces user configuration after framework defaults, any duplicate keys deep-merged are overriden by the user-defined items during collection.This allows the user-defined disk to silently take precedence over the framework-default disk for that shared URI — exactly what one would expect.
Changes
FilesystemServiceProvider::serveFiles()— Separate disk iteration into a Map collections checklist (no exceptions on URI collision) before bindingapp->booted.