From 41668d041b41d1f6fa51e08c6f3698c1bc3dc9b3 Mon Sep 17 00:00:00 2001 From: Oliver Bartsch <bo@cedev.de> Date: Thu, 15 Feb 2024 12:04:11 +0100 Subject: [PATCH] [BUGFIX] Prevent TypeError in file related webhook messages Since FileInterface->getPublicUrl() might return `NULL`, corresponding constructor arguments are updated to now expect `?string`. Resolves: #103051 Releases: main, 12.4 Change-Id: I8d16c6b9361694733dc2c5c4b2e69693fe25cff4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82979 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- typo3/sysext/webhooks/Classes/Message/FileAddedMessage.php | 2 +- typo3/sysext/webhooks/Classes/Message/FileRemovedMessage.php | 2 +- typo3/sysext/webhooks/Classes/Message/FileUpdatedMessage.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/webhooks/Classes/Message/FileAddedMessage.php b/typo3/sysext/webhooks/Classes/Message/FileAddedMessage.php index 7c151bc1dc6a..597ff81f1aef 100644 --- a/typo3/sysext/webhooks/Classes/Message/FileAddedMessage.php +++ b/typo3/sysext/webhooks/Classes/Message/FileAddedMessage.php @@ -35,7 +35,7 @@ final class FileAddedMessage implements WebhookMessageInterface public function __construct( private readonly int $storageUid, private readonly string $identifier, - private readonly string $publicUrl + private readonly ?string $publicUrl ) {} public static function createFromEvent(AfterFileAddedEvent $event): self diff --git a/typo3/sysext/webhooks/Classes/Message/FileRemovedMessage.php b/typo3/sysext/webhooks/Classes/Message/FileRemovedMessage.php index 48095049fcfb..e42a72c2ea19 100644 --- a/typo3/sysext/webhooks/Classes/Message/FileRemovedMessage.php +++ b/typo3/sysext/webhooks/Classes/Message/FileRemovedMessage.php @@ -35,7 +35,7 @@ final class FileRemovedMessage implements WebhookMessageInterface public function __construct( private readonly int $storageUid, private readonly string $identifier, - private readonly string $publicUrl + private readonly ?string $publicUrl ) {} public static function createFromEvent(BeforeFileDeletedEvent $event): self diff --git a/typo3/sysext/webhooks/Classes/Message/FileUpdatedMessage.php b/typo3/sysext/webhooks/Classes/Message/FileUpdatedMessage.php index 7573d232f193..eb81f46ed711 100644 --- a/typo3/sysext/webhooks/Classes/Message/FileUpdatedMessage.php +++ b/typo3/sysext/webhooks/Classes/Message/FileUpdatedMessage.php @@ -33,7 +33,7 @@ final class FileUpdatedMessage implements WebhookMessageInterface public function __construct( private readonly int $storageUid, private readonly string $identifier, - private readonly string $publicUrl, + private readonly ?string $publicUrl, private readonly array $relevantProperties, private readonly array $updatedFields ) {} -- GitLab