Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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 <[email protected]>
  • Loading branch information
come-nc committed Dec 12, 2024
commit ca1e3828aa1ceb6fb2366ccecd619b28dfce8f31
8 changes: 7 additions & 1 deletion lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ protected function verifyPassword($password) {
}

// 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);
}
}

/**
Expand Down Expand Up @@ -768,6 +773,7 @@ public function createShare(IShare $share) {
* @param IShare $share
* @return IShare The share object
* @throws \InvalidArgumentException
* @throws HintException
*/
public function updateShare(IShare $share) {
$expirationDateUpdated = false;
Expand Down