Skip to content

Commit 89c6af1

Browse files
committed
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 <fenn25.fn@gmail.com>
1 parent 8c6d314 commit 89c6af1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,8 @@ public function updateShare(
13901390
} catch (HintException $e) {
13911391
$code = $e->getCode() === 0 ? 403 : $e->getCode();
13921392
throw new OCSException($e->getHint(), (int)$code);
1393+
} catch (\InvalidArgumentException $e) {
1394+
throw new OCSBadRequestException($e->getMessage(), $e);
13931395
} catch (\Exception $e) {
13941396
$this->logger->error($e->getMessage(), ['exception' => $e]);
13951397
throw new OCSBadRequestException('Failed to update share.', $e);

0 commit comments

Comments
 (0)