diff options
author | Joas Schilling <coding@schilljs.com> | 2023-05-10 07:15:28 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-05-10 07:20:48 +0200 |
commit | 0a674941d63587b0458c26510c9f04750bc62d60 (patch) | |
tree | 0e36e51d67547e168f1c5bdcccd17eb76262010b /lib | |
parent | 69141dbf5436cf3384a686426061d35a73b394ba (diff) |
fix(chat): Prevent empty chat messages on API level
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/ChatController.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 06b933196..ea410faf8 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -214,6 +214,10 @@ class ChatController extends AEnvironmentAwareController { #[RequirePermission(permission: RequirePermission::CHAT)] #[RequireReadWriteConversation] public function sendMessage(string $message, string $actorDisplayName = '', string $referenceId = '', int $replyTo = 0, bool $silent = false): DataResponse { + if (trim($message) === '') { + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } + [$actorType, $actorId] = $this->getActorInfo($actorDisplayName); if (!$actorId) { return new DataResponse([], Http::STATUS_NOT_FOUND); |