Voyager: default avatar is gone

Created on 14 Nov 2017  路  7Comments  路  Source: the-control-group/voyager

Description:

Thanks very much for your efforts, and sorry if there is too much load on you to fix all that bugs, But
when i delete any user with default avatar from Voyager UI, Default avatar deleted too, So every time i must upload the default avatar again.

Steps To Reproduce:

1- Create new user.
2- Upload a new avatar and remove the old one.
3- Change the new avatar name to default.
4- Go to users page and delete any user with default avatar.
5- Go to the media section -> users

help wanted possible bug

Most helpful comment

Same problem here

UPDATE: I found the problem, I hadn鈥檛 changed the APP_URL on the .env file

All 7 comments

Same problem here

UPDATE: I found the problem, I hadn鈥檛 changed the APP_URL on the .env file

I confirm that if a user with the default avatar is deleted, the image _users/default.png_ is deleted. It seems there is no check in the cleanup function of the VoyagerBreadControllerclass for shared images (and files in general).

I am not so familiar with the code to know if other files can be shared, but if this is not the case, a simple check in deleteBreadImages function for _users/default.png_, which should never be deleted, would solve this issue.

Instead of (line 426 in VoyagerBreadController.php):

$this->deleteFileIfExists($data->{$row->field});

Insert check:

if($data->{$row->field} != "users/default.png") {
    $this->deleteFileIfExists($data->{$row->field});
}

I'm okay with that as a stop-gap solution. Other files can be shared, but not through the file/image upload fields, which is how they're being deleted, so this should be good. We'll be doing a rewrite in a future release for how Voyager manages media (files and images) that get uploaded to it, so keep an eye open for that.

Would you like to open the PR for that change, @dfk7677? If not, we can wait for someone else to do so (I don't have the time at the moment, but may later tonight)

This was fixed in #2233

@millerone thanks i changed the APP_URL on the .env file and it work for me

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TXRRNT picture TXRRNT  路  3Comments

ferrywae picture ferrywae  路  4Comments

popica80 picture popica80  路  3Comments

wp-src picture wp-src  路  3Comments

winex01 picture winex01  路  3Comments