Fix duplicate getUploadedFileNameForStorageUsing callbacks in Colors.php #336
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