Fix duplicate getUploadedFileNameForStorageUsing callbacks in Colors.php#336
Merged
Cannonb4ll merged 1 commit intoploi:mainfrom Feb 4, 2026
Conversation
Both the logo and favicon FileUpload fields had two getUploadedFileNameForStorageUsing
callbacks. The second callback overrides the first (PHP method chaining), causing:
- Logo: stored with an absolute server path (storage_path(...)) instead of 'logo-{name}'
- Favicon: the correct callback was second, but the first (broken) one was redundant
This removes the duplicate callbacks, keeping only the correct ones:
- Logo: 'logo-{originalname}'
- Favicon: 'favicon.png'
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.
Bug
In
app/Filament/Pages/Colors.php, both the logo and faviconFileUploadfields have duplicategetUploadedFileNameForStorageUsing()callbacks chained on them. Since PHP method chaining means the last call wins, this causes:Logo field
The second (incorrect) callback overrides the first and returns
storage_path("app/public/...")— an absolute server path like/var/www/html/storage/app/public/logo-foo.png— instead of a relative filename. This gets stored as the filename, resulting in broken image URLs.Favicon field
The first (incorrect) callback returns
storage_path("app/public/favicon.png"), but is overridden by the second (correct) one returning"favicon.png". The broken callback is dead code but misleading.Fix
Remove the duplicate
getUploadedFileNameForStorageUsing()callbacks, keeping only the correct ones:logo-{originalname}(relative filename)favicon.png(relative filename)Before (logo example)
After