### Eclipse Workspace Patch 1.0 #P image v5 Index: image.module =================================================================== RCS file: /cvs/drupal/contributions/modules/image/image.module,v retrieving revision 1.209.2.18 diff -u -r1.209.2.18 image.module --- image.module 2 Apr 2007 16:38:18 -0000 1.209.2.18 +++ image.module 3 Apr 2007 23:26:08 -0000 @@ -621,12 +621,16 @@ while ($file = db_fetch_object($result)) { // Never delete the original! if ($file->filepath != $node->images[IMAGE_ORIGINAL]) { - file_delete(file_create_path($file->filepath)); + + // only delete files in the image folder + $image_path = variable_get('image_default_path', 'images').'/'; + if ( strpos($file->filepath, $image_path)) { + file_delete(file_create_path($file->filepath)); + db_query("DELETE FROM {files} WHERE fid = %d", $file->fid); + db_query("DELETE FROM {file_revisions} WHERE vid = %d AND fid = %d", $node->vid, $file->fid); + } } } - $original_fid = db_result(db_query("SELECT fid FROM {files} WHERE nid=%d AND filename = '%s'", $node->nid, IMAGE_ORIGINAL)); - db_query("DELETE FROM {files} WHERE nid = %d AND filename <> '%s'", $node->nid, IMAGE_ORIGINAL); - db_query("DELETE FROM {file_revisions} WHERE vid = %d AND fid <> %d", $node->vid, $original_fid); } /**