Summary:
Deleting comments from content types that use an imagecache preset to display the image can cause subsequent comment uploads to display incorrect imagecache generated images. This can occur when a comment containing 1 or more uploads is deleted because comment_upload module only deletes the original file and leaves imagecache generated images behind.

Steps to reproduce:

  1. Start with installing comment_upload module and imagecache module. Create an imagecache preset to use on comment uploads.
  2. Enable comment uploads on a content type (under comment settings), and select the imagecache preset for the upload display
  3. Add a new comment to a node of that content type. Include an image upload
  4. In your files and files/imagecache/PRESETNAME/ folder, verify the original file and an imagecache generated version exist
  5. Delete the comment
  6. In your files and files/imagecache/PRESETNAME/ folder, verify that the original file has been removed and that the imagecache generated version remains

This is a problem when a file with the same name is uploaded when the original of that file is deleted, but the imagecache version remains. It can lead to imagecache serving an incorrect image to the user.

Example scenario:
When uploading images from an i-device, the image is always named "image.png" (at least at this time, with iOS 7). When an original file named image.png is deleted and another iPhone user uploads an image to a comment (which will be named image.png), imagecache will see that there is already an image.png cache file in the preset folder and serve that incorrect image.

CommentFileSizeAuthor
#2 imagecache-files-not-deleted-2211737.patch918 bytesr.aubin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

r.aubin’s picture

Issue summary: View changes
r.aubin’s picture

Attached is a patch that will handle deleting imagecache images when the comment and original images are deleted.

r.aubin’s picture

Status: Active » Needs review