Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed rtrim to str_replace inside "determineDiskName" method #493

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

Perzonallica
Copy link

There was an issue with rtrim which removed also the last character from the $collectionName.

Example

I have multiple different disks defined inside config/filesystems.php.
I have a custom layout created App\Nova\Flexible\Layouts\GalleryLayout with the HasMediaLibrary trait. The name of the attribute there is articleImage which represents the name of the collection inside the determineDiskName --> whitecube/nova-flexible-content/src/FileAdder/FileAdder.php:34.

So the $collectionName together with suffix is something like: articleImage_cTWnzJ0PsPJXzxWJ.

After the rtrim result I've got: articleImag This caused that the determineDiskName method always returned the public disk, because such collection was not found.

The str_replace fixes this issue.

@wize-wiz
Copy link

@Perzonallica @voidgraphics I can confirm this. rtrim isn't meant to be replacing strings, but a list of characters.

@voidgraphics voidgraphics merged commit 824225b into whitecube:master Jan 15, 2024
@voidgraphics
Copy link
Member

voidgraphics commented Jan 15, 2024

Looks good, thanks! Will try to publish a new release later today

@Perzonallica Perzonallica deleted the determineDiskName-fix branch January 15, 2024 10:27
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.

3 participants