diff --git modules/file/file.module modules/file/file.module index cec1473..2446f43 100644 --- modules/file/file.module +++ modules/file/file.module @@ -141,6 +141,12 @@ function file_file_download($uri, $field_type = 'file') { // Find out which (if any) file fields contain this file. $references = file_get_file_references($file, NULL, FIELD_LOAD_REVISION, $field_type); + // If there are no references, stop processing to avoid returning the headers + // multiple times. + if (empty($references)) { + return; + } + // Default to allow access. $denied = FALSE; // Loop through all references of this file. If a reference explicitly allows diff --git modules/image/image.module modules/image/image.module index 1dadcb0..f758d07 100644 --- modules/image/image.module +++ modules/image/image.module @@ -287,6 +287,8 @@ function image_file_download($uri) { array_shift($args); // Get the style name from the second part. $style_name = array_shift($args); + // Remove the scheme from the path. + array_shift($args); // Then the remaining parts are the path to the image. $original_uri = file_uri_scheme($uri) . '://' . implode('/', $args);