diff --git a/modules/file/file.module b/modules/file/file.module index 4fc9985..b27388e 100644 --- a/modules/file/file.module +++ b/modules/file/file.module @@ -143,8 +143,12 @@ function file_file_download($uri, $field_type = 'file') { $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. - if (empty($references)) { + // for files controlled by other modules. The only exception to this rule are + // temporary files where the host entity has not yet been saved (for example, + // an image file attached to a node). Such files may always be downloaded by + // their owner. + + if (($file->status == FILE_STATUS_PERMANENT && empty($references)) || ($file->uid != $user->uid )) { return; }