From 50c02e33f620dcc25cbbf5bf6f47dac03412c6e9 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 21 Mar 2024 20:40:28 +0100 Subject: [PATCH] fix(Operation): getLocalFile returns false meanwhile - plus cosmetic changes Signed-off-by: Arthur Schiwon --- lib/BackgroundJobs/Launcher.php | 2 +- lib/Operation.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/BackgroundJobs/Launcher.php b/lib/BackgroundJobs/Launcher.php index 1a20e0c..7930bbd 100644 --- a/lib/BackgroundJobs/Launcher.php +++ b/lib/BackgroundJobs/Launcher.php @@ -59,7 +59,7 @@ class Launcher extends QueuedJob { $command = str_replace('%f', escapeshellarg($tmpFile), $command); } - // with wrapping sh around the the command, we leave any redirects in tact, + // with wrapping sh around the command, we leave any redirects intact, // but ensure that the script is not blocking Nextcloud's execution $wrapper = 'sh -c ' . escapeshellarg($command) . ' >/dev/null &'; $this->logger->info( diff --git a/lib/Operation.php b/lib/Operation.php index 7d4cd49..b86c445 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -172,7 +172,7 @@ class Operation implements ISpecificOperation { } $this->jobList->add(Launcher::class, $args); } - } catch (NotFoundException $e) { + } catch (NotFoundException) { } } @@ -199,11 +199,11 @@ class Operation implements ISpecificOperation { if ($node instanceof FileNode) { $fullPath = $view->getLocalFile($node->getPath()); } - if ($fullPath === null) { + if (!isset($fullPath) || $fullPath === false) { throw new InvalidArgumentException(); } $command = str_replace('%f', escapeshellarg($fullPath), $command); - } catch (Exception $e) { + } catch (Exception) { throw new InvalidArgumentException('Could not determine full path'); } } @@ -212,7 +212,7 @@ class Operation implements ISpecificOperation { $nodeID = -1; try { $nodeID = $node->getId(); - } catch (InvalidPathException | NotFoundException $e) { + } catch (InvalidPathException | NotFoundException) { } $command = str_replace('%i', escapeshellarg((string)$nodeID), $command); }