From 89c6af10d149bc39728f67d1675e3038baca04b7 Mon Sep 17 00:00:00 2001 From: nfebe Date: Sat, 21 Mar 2026 01:01:58 +0100 Subject: [PATCH] fix(sharing): Surface specific error message on share update failure InvalidArgumentException from the share manager (e.g. "Cannot enable sending the password by Talk with an empty password") was caught by the generic Exception handler and re-thrown as "Failed to update share.", hiding the actual cause from the user. Catch it separately to preserve the original message. Signed-off-by: nfebe --- apps/files_sharing/lib/Controller/ShareAPIController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 0f1ad3bd5d557..e131dbcb93673 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1390,6 +1390,8 @@ public function updateShare( } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), (int)$code); + } catch (\InvalidArgumentException $e) { + throw new OCSBadRequestException($e->getMessage(), $e); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e]); throw new OCSBadRequestException('Failed to update share.', $e);