diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-11-19 09:40:26 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-12-12 15:38:16 +0100 |
commit | 2fa67bfd52f4fd1321aa0290ded7e336ceb0673b (patch) | |
tree | f86aac856b414d3610067a4ea1a838506995e9dc /apps | |
parent | 9e1b516e2b202708bc605f43c0d607a5f3b46561 (diff) | |
download | nextcloud-server-2fa67bfd52f4fd1321aa0290ded7e336ceb0673b.tar.gz nextcloud-server-2fa67bfd52f4fd1321aa0290ded7e336ceb0673b.zip |
fix(files_sharing): Fix error messages from password policy
Exceptions thrown from password_policy may bubble up in share creation
or update when a password is used. Their message is meant to be shown
to the user. This always the case for HintException so we catch that
instead of the subclass GenericShareException.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 616c175a9b4..f6c106b9b08 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -34,6 +34,7 @@ use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; +use OCP\HintException; use OCP\IConfig; use OCP\IDateTimeZone; use OCP\IGroupManager; @@ -46,7 +47,6 @@ use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use OCP\Mail\IMailer; use OCP\Server; -use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IProviderFactory; @@ -810,7 +810,7 @@ class ShareAPIController extends OCSController { try { $share = $this->shareManager->createShare($share); - } catch (GenericShareException $e) { + } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), $code); } catch (\Exception $e) { @@ -1351,7 +1351,7 @@ class ShareAPIController extends OCSController { try { $share = $this->shareManager->updateShare($share); - } catch (GenericShareException $e) { + } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), (int)$code); } catch (\Exception $e) { @@ -1439,7 +1439,7 @@ class ShareAPIController extends OCSController { try { $this->shareManager->acceptShare($share, $this->currentUser); - } catch (GenericShareException $e) { + } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); throw new OCSException($e->getHint(), (int)$code); } catch (\Exception $e) { |