mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-22 00:03:28 +01:00
parent
9c6d13559b
commit
6fd9a7d37f
@ -1,3 +1,4 @@
|
|||||||
|
import glob
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -1405,6 +1406,13 @@ def media_file_delete(sender, instance, **kwargs):
|
|||||||
helpers.rm_dir(p)
|
helpers.rm_dir(p)
|
||||||
instance.user.update_user_media()
|
instance.user.update_user_media()
|
||||||
|
|
||||||
|
# remove extra zombie thumbnails
|
||||||
|
if instance.thumbnail:
|
||||||
|
thumbnails_path = os.path.dirname(instance.thumbnail.path)
|
||||||
|
thumbnails = glob.glob(f'{thumbnails_path}/{instance.uid.hex}.*')
|
||||||
|
for thumbnail in thumbnails:
|
||||||
|
helpers.rm_file(thumbnail)
|
||||||
|
|
||||||
|
|
||||||
@receiver(m2m_changed, sender=Media.category.through)
|
@receiver(m2m_changed, sender=Media.category.through)
|
||||||
def media_m2m(sender, instance, **kwargs):
|
def media_m2m(sender, instance, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user