canvas icon indicating copy to clipboard operation
canvas copied to clipboard

Recent uploaded images are NOT deleted

Open armancodes opened this issue 5 years ago • 6 comments

I have noticed that whenever I upload a file and DELETE it in that post the recently uploaded image is not being deleted from storage/public directory:

image This can make the application heavy in terms of the space that should be dedicated to it.

armancodes avatar Mar 21 '20 21:03 armancodes

That's a known issue. I'll see what I can do about getting it into a future release.

austintoddj avatar Mar 22 '20 10:03 austintoddj

I have an idea about it. You get the file names in the storage folder. Then you check your database. In your database canvas_posts in the body column, you should see if that image name exists in any of those records. As far as the query can be heavy enough to make the application slow it can be done through Laravel scheduler (once a day or whatever).

armancodes avatar Mar 22 '20 10:03 armancodes

I'd be happy if you assign this task to me so that I'll be able to fix it.😊

armancodes avatar Mar 22 '20 10:03 armancodes

I think the better route to go for this would be to handle this in the Vue components, specifically where we have methods that remove images. There, you could hit a single DELETE route with the filename, do a quick lookup in the MediaController, and return the proper response after the action is taken.

Let me know what you think, I'll assign this to both of us and I'll be more than happy to check out a PR once you've got one ready!

austintoddj avatar Mar 22 '20 10:03 austintoddj

Is this bug already fixed for a future release? Can I help to fix it?

Khanabeev avatar Nov 30 '20 17:11 Khanabeev

Thanks @Khanabeev for offering that, SUPER helpful!

It's still an open bug, so if you'd like to take a stab at it and submit a PR, I'd be more than happy to take a look.

austintoddj avatar Nov 30 '20 18:11 austintoddj