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>
This commit is contained in:
Côme Chilliet 2024-12-10 15:27:38 +01:00 committed by Côme Chilliet
parent 28d7206e5c
commit 17007f6b8d

View file

@ -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;