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
parent dab953970d
commit ca1e3828aa
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -110,7 +110,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);
}
}
/**
@ -768,6 +773,7 @@ class Manager implements IManager {
* @param IShare $share
* @return IShare The share object
* @throws \InvalidArgumentException
* @throws HintException
*/
public function updateShare(IShare $share) {
$expirationDateUpdated = false;