getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.26k stars 166 forks source link

Media file not deleted after status change #6573

Open medienbaecker opened 1 month ago

medienbaecker commented 1 month ago

Description

Normally, when deleting files, their media file gets deleted in the process. Changing the status of the parent page before deleting the file will however not delete the file.

Expected behavior
The media file should be deleted with the file.

To reproduce

  1. Upload a file to any page
  2. Change the page's status to draft
  3. Delete the file
  4. The media file is still available (and will forever be)

https://github.com/user-attachments/assets/1e9af684-1eaf-410a-8ec5-49899e645ebd

Your setup

Kirby Version
4.3.0

bastianallgeier commented 1 month ago

We need to remove the old media folder in the Page::unpublish method as it seems. https://github.com/getkirby/kirby/blob/f9f00b16a22fe9dbbbddc2bfd4719ca3437cbee9/src/Cms/PageActions.php#L920