Index: modules/file/file.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/file/file.module,v
retrieving revision 1.47
diff -u -p -r1.47 file.module
--- modules/file/file.module	23 Nov 2010 05:51:16 -0000	1.47
+++ modules/file/file.module	9 Dec 2010 00:07:51 -0000
@@ -141,7 +141,7 @@ function file_file_download($uri, $field
   }
 
   // Find out which (if any) fields of this type contain the file.
-  $references = file_get_file_references($file, NULL, FIELD_LOAD_REVISION, $field_type);
+  $references = file_get_file_references($file, NULL, FIELD_LOAD_CURRENT, $field_type);
 
   // If there are no references, stop processing, to avoid returning headers
   // for files controlled by other modules.
Index: modules/file/tests/file.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/file/tests/file.test,v
retrieving revision 1.28
diff -u -p -r1.28 file.test
--- modules/file/tests/file.test	13 Nov 2010 14:04:08 -0000	1.28
+++ modules/file/tests/file.test	9 Dec 2010 00:07:51 -0000
@@ -121,20 +121,23 @@ class FileFieldTestCase extends DrupalWe
     );
 
     if (is_numeric($nid_or_type)) {
-      $node = node_load($nid_or_type, NULL, TRUE);
-      $delta = isset($node->{$field_name}[LANGUAGE_NONE]) ? count($node->{$field_name}[LANGUAGE_NONE]) : 0;
-      $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_' . $delta . ']'] = drupal_realpath($file->uri);
-      $this->drupalPost('node/' . $nid_or_type . '/edit', $edit, t('Save'));
+      $nid = $nid_or_type;
     }
     else {
-      $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = drupal_realpath($file->uri);
-      $type_name = str_replace('_', '-', $nid_or_type);
-      $this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
+      // Add a new node.
+      $node = $this->drupalCreateNode(array('type' => $nid_or_type));
+      $nid = $node->nid;
+      // Save at least one revision to better simulate a real site.
+      $this->drupalCreateNode(get_object_vars($node));
+      $node = node_load($nid, NULL, TRUE);
+      $this->assertNotEqual($nid, $node->vid, t('Node revision exists.'));
     }
 
-    $matches = array();
-    preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches);
-    return isset($matches[1]) ? $matches[1] : FALSE;
+    // Attach a file to the node.
+    $edit['files[' . $field_name . '_' . $langcode . '_0]'] = drupal_realpath($file->uri);
+    $this->drupalPost("node/$nid/edit", $edit, t('Save'));
+
+    return $nid;
   }
 
   /**
