This issue is with a potential of won't fix, however:

{files} isn't indexed in 'filepath' so there is a chance of duplicate records.

function filefield_file_download($file) {
  $file = file_create_path($file);

  $result = db_query("SELECT * FROM {files} WHERE filepath = '%s'", $file);
  if (!$file = db_fetch_object($result)) {
    // We don't really care about this file.
    return;
  }

The code only checks the first fid, which might result with a 404 on a legal file.

Comments

dopry’s picture

Status: Active » Closed (won't fix)

hai... this was a result of you field_file_save_file / replace issue... There shouldn't ever be two files in the DB with the same path. that makes this a non issue as the state is undefined.