From e7b914ff4b49f2acf4a4c59555b6aabc241e462d Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 18 Feb 2023 09:54:51 +0200 Subject: [PATCH] ref --- application/Espo/EntryPoints/Download.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/application/Espo/EntryPoints/Download.php b/application/Espo/EntryPoints/Download.php index 169258d71e..1729600332 100644 --- a/application/Espo/EntryPoints/Download.php +++ b/application/Espo/EntryPoints/Download.php @@ -43,22 +43,12 @@ use Espo\Core\Utils\Metadata; class Download implements EntryPoint { - protected FileStorageManager $fileStorageManager; - protected Acl $acl; - protected EntityManager $entityManager; - private Metadata $metadata; - public function __construct( - FileStorageManager $fileStorageManager, - Acl $acl, - EntityManager $entityManager, - Metadata $metadata - ) { - $this->fileStorageManager = $fileStorageManager; - $this->acl = $acl; - $this->entityManager = $entityManager; - $this->metadata = $metadata; - } + protected FileStorageManager $fileStorageManager, + protected Acl $acl, + protected EntityManager $entityManager, + private Metadata $metadata + ) {} public function run(Request $request, Response $response): void { @@ -85,7 +75,7 @@ class Download implements EntryPoint $stream = $this->fileStorageManager->getStream($attachment); - $outputFileName = str_replace("\"", "\\\"", $attachment->get('name')); + $outputFileName = str_replace("\"", "\\\"", $attachment->getName() ?? ''); $type = $attachment->getType();