Skip to content

Commit

Permalink
fix: usage of verify method
Browse files Browse the repository at this point in the history
Previous commit made a wrong usage of verify method

Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Jun 17, 2024
1 parent 29c7951 commit 193c7c0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/Service/Install/InstallService.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function getFolder(string $path = '', ?ISimpleFolder $folder = null, $ne
}
$path = explode('/', $path);
foreach ($path as $snippet) {
$folder = $this->getFolder($snippet, $folder);
$folder = $this->getFolder($snippet, $folder, $needToBeEmpty);
}
return $folder;
}
Expand Down Expand Up @@ -340,11 +340,7 @@ public function setResource(string $resource): self {
}

public function isDownloadedFilesOk(): bool {
try {
return count($this->signSetupService->verify($this->architecture, $this->resource)) === 0;
} catch (InvalidSignatureException|SignatureDataNotFoundException|EmptySignatureDataException|NotFoundException $e) {
return false;
}
return count($this->signSetupService->verify($this->architecture, $this->resource)) === 0;
}

public function installJava(?bool $async = false): void {
Expand All @@ -353,10 +349,12 @@ public function installJava(?bool $async = false): void {
$this->runAsync();
return;
}
$folder = $this->getEmptyFolder($this->resource);
$extractDir = $this->getFullPath() . '/' . $this->resource;

if (!$this->isDownloadedFilesOk()) {
if ($this->isDownloadedFilesOk()) {
$folder = $this->getFolder($this->resource);
} else {
$folder = $this->getEmptyFolder($this->resource);
/**
* Steps to update:
* Check the compatible version of Java to use JSignPdf
Expand Down Expand Up @@ -433,10 +431,12 @@ public function installJSignPdf(?bool $async = false): void {
$this->runAsync();
return;
}
$folder = $this->getEmptyFolder($this->resource);
$extractDir = $this->getFullPath() . '/' . $this->resource;

if (!$this->isDownloadedFilesOk()) {
if ($this->isDownloadedFilesOk()) {
$folder = $this->getFolder($this->resource);
} else {
$folder = $this->getEmptyFolder($this->resource);
$compressedFileName = 'jsignpdf-' . JSignPdfHandler::VERSION . '.zip';
try {
$compressedFile = $folder->getFile($compressedFileName);
Expand Down Expand Up @@ -534,9 +534,10 @@ public function installCfssl(?bool $async = false): void {
}

private function installCfsslByArchitecture(string $arcitecture): void {
$folder = $this->getEmptyFolder($this->resource);

if ($this->isDownloadedFilesOk()) {
$folder = $this->getFolder($this->resource);
} else {
$folder = $this->getEmptyFolder($this->resource);
$downloads = [
[
'file' => 'cfssl_' . self::CFSSL_VERSION . '_linux_' . $arcitecture,
Expand Down

0 comments on commit 193c7c0

Please sign in to comment.