In function node_export_file_import_file, when it tries to establish if the exported file is the same as the existing one (under an old FIXME comment that does not apply anymore), it compares the filesize as well as the CRC of both files.
But in the second case, it uses the $file->uri to get file_contents, which is not the same as the property used so far. And at least in my case, it fails as the $file->uri field is empty.

In short, this comparison

if (is_file($file->filepath) &&
    (
      !is_file($file->node_export_file_path) ||
      (
        is_file($file->node_export_file_path) &&
        filesize($file->filepath) == filesize($file->node_export_file_path) &&
        strtoupper(dechex(crc32(file_get_contents($file->uri)))) ==
          strtoupper(dechex(crc32(file_get_contents($file->node_export_file_path))))
      )
    )
  ) {
    drupal_write_record('files', $file);
  }

should be

if (is_file($file->filepath) &&
    (
      !is_file($file->node_export_file_path) ||
      (
        is_file($file->node_export_file_path) &&
        filesize($file->filepath) == filesize($file->node_export_file_path) &&
        strtoupper(dechex(crc32(file_get_contents($file->filepath)))) ==
          strtoupper(dechex(crc32(file_get_contents($file->node_export_file_path))))
      )
    )
  ) {
    drupal_write_record('files', $file);
  }
Files: 
CommentFileSizeAuthor
#1 node_export_file-import_1988208_0.patch705 bytespbanderas

Comments

pbanderas’s picture

Assigned: pbanderas » Unassigned
FileSize
705 bytes

Patch proposal

danielb’s picture

Status: Needs review » Closed (outdated)