Skip to content

Commit cdda566

Browse files
committed
chore: remove unecessary check if node exists
The method get already do this and throw an exception when the file don't exists. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent a067682 commit cdda566

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/Handler/SignEngine/SignEngineHandler.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,11 @@ public function getPfxOfCurrentSigner(?string $uid = null): string {
180180
}
181181
$this->folderService->setUserId($uid);
182182
$folder = $this->folderService->getFolder();
183-
if (!$folder->nodeExists($this->pfxFilename)) {
184-
throw new LibresignException($this->l10n->t('Password to sign not defined. Create a password to sign.'), 400);
185-
}
186183
try {
187184
/** @var \OCP\Files\File */
188185
$node = $folder->get($this->pfxFilename);
189186
$this->certificate = $node->getContent();
190-
} catch (GenericFileException) {
187+
} catch (GenericFileException|NotFoundException) {
191188
throw new LibresignException($this->l10n->t('Password to sign not defined. Create a password to sign.'), 400);
192189
} catch (\Throwable) {
193190
}

0 commit comments

Comments
 (0)