getkirby / kirby

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

Media file not deleted after status change #6573

Open medienbaecker opened 3 months ago

medienbaecker commented 3 months 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 3 months 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