U4-172 - Emptying Media Recycle Bin Deletes all Media items and files in Media Root

Created by Paul Sterling 15 Aug 2012, 22:25:10 Updated by Sebastiaan Janssen 31 Oct 2012, 09:15:33

Subtask of: U4-760

This issue has been reported here: http://our.umbraco.org/forum/core/general/20452-Emptying-RecycleBin-in-Media-deletes-media-folder-and-all-files-within

Essentially if a user uploads media into the root media folder, then deletes any item (placing it in the recycle bin), then empties the recycle bin - all media items and corresponding files are deleted from disk. It appears that emptying the recycle bin causes a cleanup of files in the media item's parent folder and, as the parent folder for items in the media root is the root itself, all files are deleted.

Fortunately, placing items in the media root is considered poor practice and is not frequently done. The empty method should check if the current folder is the media root and be cautious about deleting files in this case - perhaps checking the file count as an indicator of the delete being overly aggressive.

Comments

Erik Murphy 01 Oct 2012, 13:56:40

This issue can also be reproduced by deleting a page from the recycle bin in the content section if that page has a property that references a media item on the root of the media folder.


Erik Murphy 01 Oct 2012, 13:57:38

I experienced this issue on v4.7.1.


Sara Cassinelli 11 Oct 2012, 21:31:01

We also experienced this issue twice when we selected "Empty recycle bin" in the media section, or when we tried to delete an item individually in the recycle bin. Both times, we lost the root media folder and all of our media links/images broke or disappeared on our site.


Sebastiaan Janssen 22 Oct 2012, 09:34:54

This has been fixed in the mean time, it seemed to only happen when you had UploadAllowDirectories set to false in umbracoSettings.config. Unfortunately I can't pinpoint exactly where it got fixed but I believe it was in either 4.8.1 or 4.8.2.

Anyway, I just tested this in 4.10.0 and it works as it should.


Sara Cassinelli 24 Oct 2012, 18:50:11

Thank you! We updated our version of Umbraco and everything worked perfectly.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 4.8.0

Due in version: 4.10.0

Sprint:

Story Points:

Cycle: