diff --git a/app/code/Magento/MediaStorage/App/Media.php b/app/code/Magento/MediaStorage/App/Media.php index fd73519ebd290..21f6fa863aaf2 100644 --- a/app/code/Magento/MediaStorage/App/Media.php +++ b/app/code/Magento/MediaStorage/App/Media.php @@ -190,7 +190,8 @@ public function launch(): ResponseInterface $fileAbsolutePath = $this->directoryPub->getAbsolutePath($this->relativeFileName); $fileRelativePath = str_replace(rtrim($this->mediaDirectoryPath, '/') . '/', '', $fileAbsolutePath); if (!$isAllowed($fileRelativePath, $allowedResources)) { - throw new LogicException('The path is not allowed: ' . $this->relativeFileName); + require_once 'errors/404.php'; + exit; } }