? cck-1.patch
? node.txt
? remove-file-image-200092-5x-2x-17.patch
Index: clone.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/node_clone/clone.module,v
retrieving revision 1.9.2.12
diff -u -p -r1.9.2.12 clone.module
--- clone.module	4 May 2008 00:51:50 -0000	1.9.2.12
+++ clone.module	21 May 2008 22:07:26 -0000
@@ -157,7 +157,24 @@ function clone_node($nid) {
       $node->files = array();
       $node->title = t('Clone of !title', array('!title' => $node->title));
       drupal_set_title(check_plain($node->title));
-
+      // Remove CCK file and image attachements
+      if (module_exists('imagefield') || module_exists('filefield')) {
+        $content_type = array();
+        $content_type += module_invoke('content', 'types', $node->type);
+        $file_fields = array();
+        // Find all the fields
+        foreach ($content_type['fields'] as $data) {
+          if (($data['type'] == 'file') || ($data['type'] == 'image')) {
+             $file_fields[] = $data['field_name'];
+          }
+        }
+        // Remove any attached files as with $node->files
+        foreach ($file_fields as $key) {
+          if (isset($node->$key)) {
+            $node->$key = array(); 
+          }
+        }
+      }
       if (variable_get('clone_reset_'. $node->type, FALSE)) {
         $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
         // fill in the default values
