Delete doesn't work for missing files

smk-ka - July 8, 2008 - 17:35
Project:ImageField
Version:5.x-2.1
Component:Code
Category:bug report
Priority:normal
Assigned:smk-ka
Status:closed
Description

This is an edge case: when flagging an image for deletion that is missing on the hard disc (ie. it has been manually deleted), the stored CCK field data will not be updated. This happens because imagefield_file_update() only returns an empty array (which would cause the CCK field to be updated), if the call to _imagefield_file_delete() and, subsequently, file_delete() returns true. However, if an image is flagged for deletion, the result of file_delete() shouldn't matter at all -- the image should *always* be removed from the content as requested.

The attached patch fixes the logic in imagefield_file_update() to always return an empty array.

AttachmentSize
imagefield-delete.patch889 bytes

#1

sun - August 14, 2008 - 22:28
Status:patch (code needs review)» patch (reviewed & tested by the community)

+1

#2

dopry - August 15, 2008 - 02:31
Status:patch (reviewed & tested by the community)» fixed

Hey sun... If you want to +1 a patch... try to write a sentence about how you tested it what you did and that it worked for you.. So actually review and test and post your findings!

committed to DRUPAL-5, we're blaming sun if file deletion destroys peoples sites in the next imagefield release.. ;)

#3

Anonymous (not verified) - August 29, 2008 - 02:32
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.