New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orphaned files if file is replaced via Advanced -> Replace in admin #954
Comments
I've tried one of the suggestions from stackoverflow... Adding this to the save method of filer.models.File seems to do the trick:
As far as i understand it would make sense to add this behaviour. Either no files should be deleted at all or all files should be deleted on every action. |
Although, it doesn't fix this bug, you may manually apply this pending PR #912. It adds a management command to remove orphaned file. |
@jrief Thank you... actually I already stumbled over your PR and right now modifying it to delete also the thumbnails which are located in filer_public_thumbnails. |
@SachaMPS if you have some time to work on this pull request, it would be great. I think @yakky 's proposal to add one command named
would fulfill all of our requirements. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This will now be closed due to inactivity, but feel free to reopen it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This will now be closed due to inactivity, but feel free to reopen it. |
We noticed that we have lots of orphaned media files in filer_public/.
The root cause of this seems to be if a user replaces a file via Admin > Adnvanced > File:
https://github.com/divio/django-filer/blob/develop/filer/admin/fileadmin.py#L55
Replacing a file won't delete the old file and won't delete all depending files like created thumbnails.
It seems that this is a very well known problem by django itself:
http://stackoverflow.com/questions/4394194/replacing-a-django-image-doesnt-delete-original
http://stackoverflow.com/questions/4787141/django-how-to-replace-overwrite-update-change-a-file-of-filefield
https://code.djangoproject.com/ticket/11663#no1
So my question is: Can this be regarded as a bug and should it be fixed in django-filer?
The text was updated successfully, but these errors were encountered: