From acac898bc26d2d9bec5fa41951e7f633e5f0da2c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 22 Feb 2019 00:22:03 -0800 Subject: [PATCH] CRM_Core_Page_File - Fix warning when using filename mode The idea here is that `id+eid+fcs` and `filename` are two separate modes. In `filename` mode, you don't need warnings about the missing `fcs`. --- CRM/Core/Page/File.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index 2a9ec348fb..b13dd9d66a 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -49,17 +49,19 @@ class CRM_Core_Page_File extends CRM_Core_Page { if (empty($fileName) && (empty($entityId) || empty($fileId))) { CRM_Core_Error::statusBounce("Cannot access file: Must pass either \"Filename\" or the combination of \"Entity ID\" + \"File ID\""); } - $hash = CRM_Utils_Request::retrieve('fcs', 'Alphanumeric', $this); - if (!CRM_Core_BAO_File::validateFileHash($hash, $entityId, $fileId) && empty($fileName)) { - CRM_Core_Error::statusBounce('URL for file is not valid'); + + if (empty($fileName)) { + $hash = CRM_Utils_Request::retrieve('fcs', 'Alphanumeric', $this); + if (!CRM_Core_BAO_File::validateFileHash($hash, $entityId, $fileId)) { + CRM_Core_Error::statusBounce('URL for file is not valid'); + } + + list($path, $mimeType) = CRM_Core_BAO_File::path($fileId, $entityId); } - if (!empty($fileName)) { + else { $mimeType = ''; $path = CRM_Core_Config::singleton()->customFileUploadDir . $fileName; } - else { - list($path, $mimeType) = CRM_Core_BAO_File::path($fileId, $entityId); - } $mimeType = CRM_Utils_Request::retrieveValue('mime-type', 'String', $mimeType, FALSE); if (!$path) { -- 2.25.1