diff --git a/core/modules/system/src/FileDownloadController.php b/core/modules/system/src/FileDownloadController.php index a65342d..8344826 100644 --- a/core/modules/system/src/FileDownloadController.php +++ b/core/modules/system/src/FileDownloadController.php @@ -52,17 +52,11 @@ public function download(Request $request, $scheme = 'private') { // Let other modules provide headers and controls access to the file. $headers = $this->moduleHandler()->invokeAll('file_download', array($uri)); - foreach ($headers as $result) { - if ($result == -1) { - throw new AccessDeniedHttpException(); - } + if (in_array(-1, $headers) || empty($headers)) { + throw new AccessDeniedHttpException(); } - if (count($headers)) { - return new BinaryFileResponse($uri, 200, $headers); - } - - throw new AccessDeniedHttpException(); + return new BinaryFileResponse($uri, 200, $headers); } throw new NotFoundHttpException();