aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-12-10 15:27:38 +0100
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-12-12 15:39:48 +0100
commit17007f6b8dae214355c164b274915413628cb5d0 (patch)
tree926a57358f88402569afd564fd4845b21eba4d68 /lib
parent28d7206e5cab68eb4b4a012574ee26275e2c74d8 (diff)
downloadnextcloud-server-17007f6b8dae214355c164b274915413628cb5d0.tar.gz
nextcloud-server-17007f6b8dae214355c164b274915413628cb5d0.zip
fix(shares): Wrap exceptions from password validation to set code to 400
This fixes a regression that bad password returned 403 instead of 400 because of previous changes. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index ea338937e2a..219f3d86380 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -112,7 +112,12 @@ class Manager implements IManager {
}
// Let others verify the password
- $this->dispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password));
+ try {
+ $this->dispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password));
+ } catch (HintException $e) {
+ /* Wrap in a 400 bad request error */
+ throw new HintException($e->getMessage(), $e->getHint(), 400, $e);
+ }
}
/**
@@ -780,7 +785,7 @@ class Manager implements IManager {
* @param IShare $share
* @return IShare The share object
* @throws \InvalidArgumentException
- * @throws GenericShareException
+ * @throws HintException
*/
public function updateShare(IShare $share, bool $onlyValid = true) {
$expirationDateUpdated = false;