When configuring the assets field in the User Blueprint to use the user ID as the folder name, non-admin users encounter an error. This happens because the first() method can return false when no matching action is found, causing the subsequent call to toArray() to fail.
Problem
When configuring the
assets
field in the User Blueprint to use the user ID as the folder name, non-admin users encounter an error. This happens because thefirst()
method can returnfalse
when no matching action is found, causing the subsequent call totoArray()
to fail.Root Cause
The issue arises from the following code:
If no matching
RenameAssetFolder
action is found,first()
returnsfalse
. ThetoArray()
method is then called on thisfalse
value, leading to an error.Solution
The fix ensures that the
first()
method's return value is properly handled using the null-safe operator?->
before attempting to calltoArray()
:This prevents the error when no matching action is found and maintains compatibility for non-admin users.