fix: Remove superfluous antislash from event name to avoid problems

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2024-06-10 16:25:12 +02:00 committed by Côme Chilliet
parent 3bc43b2a34
commit bb2cb45340

View file

@ -81,6 +81,8 @@ class WebhookListenerMapper extends QBMapper {
AuthMethod $authMethod,
?array $authData,
): WebhookListener {
/* Remove any superfluous antislash */
$event = ltrim($event, '\\');
if (!class_exists($event) || !is_a($event, IWebhookCompatibleEvent::class, true)) {
throw new \UnexpectedValueException("$event is not an event class compatible with webhooks");
}
@ -116,6 +118,8 @@ class WebhookListenerMapper extends QBMapper {
AuthMethod $authMethod,
?array $authData,
): WebhookListener {
/* Remove any superfluous antislash */
$event = ltrim($event, '\\');
if (!class_exists($event) || !is_a($event, IWebhookCompatibleEvent::class, true)) {
throw new \UnexpectedValueException("$event is not an event class compatible with webhooks");
}