cloudinary-laravel icon indicating copy to clipboard operation
cloudinary-laravel copied to clipboard

detachMedia deletes ALL images attached to an entity

Open ttrolololll opened this issue 4 years ago • 0 comments

https://github.com/cloudinary-labs/cloudinary-laravel/blob/ab0dc2d2dfefbeb67c7b282b72e6203802c36582/src/MediaAlly.php#L82

This method is problematic. It gets ALL the images associated to the entity, and deletes them all...

Need to have an if statement to check for nullness of $media param, if not null, only delete given media, else then delete all.

For a destructive action like delete all media, it should even be consider to have a separate method just for that...

ttrolololll avatar Nov 10 '21 08:11 ttrolololll