OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.42k stars 2.39k forks source link

Attached media field doesnt remove deleted file #10342

Open giannik opened 3 years ago

giannik commented 3 years ago

While trying to implement a new media editor for media field I noticed that when using attached media file and deleting a media from the admin the media item does not get deleted physically from the related folder, only the file path is updated to an empty string , bit the file remains in the related media folder.

Is this intentional ?

deanmarcussen commented 3 years ago

There's a AttachedMediaFieldFileService which handles deletion of temporary files on startup. I can't remember if it cleans up old files as well.

giannik commented 3 years ago

Yes , Ive seen that service. Im refering not to temp files but existing files in the content item media folder. Try deleting an existing file and it remains in the folder , The ui shows correctly because the Paths property is updated. Seems to me that in the vue component there is an Isremoved property on the viewmodel which is not updated from the client side.

sebastienros commented 3 years ago

That's a valid point for "this" field since it's a field per content item. The other media field however could share the same media file from different content item.