--- imagefield.module-orig	2008-03-20 01:32:08.000000000 -0500
+++ imagefield.module	2008-05-29 21:43:29.000000000 -0500
@@ -351,12 +351,31 @@ function imagefield_clear_field_session(
 }
 
 function _imagefield_file_delete($file, $fieldname) {
+  /* See if there are multiple files table entries for one file, this happens
+   * when node_clone is used.
+   */
+  $result = db_query("
+    select b.fid
+    from files a
+    join files b on a.filepath = b.filepath and a.fid != b.fid
+    where a.fid = %d
+  ", $file['fid']);
+  $multi_linked = false;
+  if($row = db_fetch_array($result)){
+    $multi_linked = true;
+  }
   if (is_numeric($file['fid'])) {
     db_query('DELETE FROM {files} WHERE fid = %d', $file['fid']);
   }
   else {
     unset($_SESSION['imagefield'][$fieldname][$file['sessionid']]);
   }
+  /* Skip the delete step, if there are links to the same file from
+   * other files table entries.
+   */
+  if($multi_linked){
+    return true;
+  }
   return file_delete($file['filepath']);
 }
 
