summaryrefslogtreecommitdiff
path: root/modules/file/file.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/file/file.module')
-rw-r--r--modules/file/file.module8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/file/file.module b/modules/file/file.module
index a79c8f542..1388f179b 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -138,9 +138,15 @@ function file_file_download($uri, $field_type = 'file') {
return;
}
- // Find out which (if any) file fields contain this file.
+ // Find out which (if any) fields of this type contain the file.
$references = file_get_file_references($file, NULL, FIELD_LOAD_REVISION, $field_type);
+ // If there are no references, stop processing, to avoid returning headers
+ // for files controlled by other modules.
+ if (empty($references)) {
+ return;
+ }
+
// Default to allow access.
$denied = FALSE;
// Loop through all references of this file. If a reference explicitly allows