From 3c99f8b41134728ad6d17c58bb4be951e5078538 Mon Sep 17 00:00:00 2001 From: Josef Behr Date: Thu, 16 Jul 2026 03:27:46 +0200 Subject: [PATCH] fix(api): correct misleading error message on empty keyValuePairs updateQuestion() rejected an empty keyValuePairs array with the message "This form is archived and can not be modified". That message is unrelated to the actual cause and sends callers looking in the wrong place. The sibling methods updateForm() and updateOption() already report this case accurately, and updateQuestion()'s own @throws annotation documents it as "Empty keyValuePairs, will not update" too, so the string looks like a copy-paste leftover from the archived-form check further up. Only the message is changed. The exception type stays OCSBadRequestException so the HTTP status code is unaffected. Signed-off-by: Josef Behr Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/Controller/ApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 946dc0445..cc882a0e1 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -675,7 +675,7 @@ public function updateQuestion(int $formId, int $questionId, array $keyValuePair // Don't allow empty array if (count($keyValuePairs) === 0) { $this->logger->info('Empty keyValuePairs, will not update.'); - throw new OCSBadRequestException('This form is archived and can not be modified'); + throw new OCSBadRequestException('Empty keyValuePairs, will not update.'); } //Don't allow to change id or formId