From f90977a39373e409cb7ca7f9e07ec8a2549e3d1f Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Mon, 2 Oct 2023 12:29:55 +0100 Subject: [PATCH] pkp/pkp-lib#9253 Require User when handling announcement image upload --- classes/announcement/Repository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/announcement/Repository.php b/classes/announcement/Repository.php index 41019994bc9..3d009811f10 100644 --- a/classes/announcement/Repository.php +++ b/classes/announcement/Repository.php @@ -230,7 +230,7 @@ protected function handleImageUpload(Announcement $announcement): void $temporaryFileManager = new TemporaryFileManager(); $temporaryFile = $temporaryFileManager->getFile((int) $image['temporaryFileId'], $user?->getId()); $filePath = $this->getImageSubdirectory() . '/' . $this->getImageFilename($announcement, $temporaryFile); - if ($this->storeTemporaryFile($temporaryFile, $filePath, $user?->getId(), $announcement)) { + if ($this->storeTemporaryFile($temporaryFile, $filePath, $user->getId(), $announcement)) { $announcement->setImage( $this->getImageData($announcement, $temporaryFile) ); @@ -248,7 +248,7 @@ protected function handleImageUpload(Announcement $announcement): void * @param string $newPath The new filename with the path relative to the public files directoruy * @return bool Whether or not the operation was successful */ - protected function storeTemporaryFile(TemporaryFile $temporaryFile, string $newPath, ?int $userId, Announcement $announcement): bool + protected function storeTemporaryFile(TemporaryFile $temporaryFile, string $newPath, int $userId, Announcement $announcement): bool { $publicFileManager = new PublicFileManager(); $temporaryFileManager = new TemporaryFileManager();