Ticket #13446 (confirmed Bug)

Opened 3 years ago

Last modified 3 years ago

blobs from scaled images are not removed if the image field is emptied

Reported by: gforcada Owned by:
Priority: minor Milestone: 4.x
Component: General Version: 4.2
Keywords: blobs Cc:

Description

The steps to reproduce this are:

  • create a document which has a NamedBlobImage field on it
  • upload an image on that field
  • see a scaled version of that image
  • if the Plone instance was new on var/blobstorage there should be now at least 2 blob files: the original image and the scaled image
  • now edit the document and remove the image
  • if you do a zeopack without keeping any history the blob from the original image is removed, but the blob from the scaled image is still around

That means that on all blobstorage enabled ZEO servers out there there are lots and lots of stale blobs around.

Where should the blame go? On zeopack to not found them? On NamedBlobImage widget implementation to not clean the scales if the image is removed? On both?

Change History

comment:1 Changed 3 years ago by kleist

  • Status changed from new to confirmed
  • Component changed from Unknown to General

comment:2 Changed 3 years ago by gforcada

To remove the scales one has to remove the plone.scale annotation:

# assume 'document' is a Dexterity-based content type that has a NamedBlobImage field 
from zope.annotation.interfaces import IAnnotations
annotations = IAnnotations(document)
if 'plone.scale' in annotations:
    del annotations['plone.scale']
if getattr(document, 'image', None) is not None and document.image is not None:
    del document.image
    document.reindexObject()
Note: See TracTickets for help on using tickets.