aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-11-19 09:40:26 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-12-12 13:15:59 +0000
commit751d1ace7d31507474e6584d263ca8f050af4df4 (patch)
treecb37670e6d7e8c6540735ad4909317b84bd78728
parentc3caf1c6d2852165fd32f5f33dccea1036438328 (diff)
downloadnextcloud-server-backport/49361/stable29.tar.gz
nextcloud-server-backport/49361/stable29.zip
fix(files_sharing): Fix error messages from password policybackport/49361/stable29
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> [skip ci]
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index bfc462ec901..561804c0f68 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -69,6 +69,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;
@@ -80,7 +81,6 @@ use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use OCP\Server;
-use OCP\Share\Exceptions\GenericShareException;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
@@ -824,7 +824,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) {
@@ -1358,7 +1358,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) {