Skip to content

fix(Operation): getLocalFile returns false meanwhile #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/BackgroundJobs/Launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function run($argument): void {
$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(
Expand Down
8 changes: 4 additions & 4 deletions lib/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch
}
$this->jobList->add(Launcher::class, $args);
}
} catch (NotFoundException $e) {
} catch (NotFoundException) {
}
}

Expand All @@ -199,11 +199,11 @@ protected function buildCommand(string $template, Node $node, string $event, arr
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');
}
}
Expand All @@ -212,7 +212,7 @@ protected function buildCommand(string $template, Node $node, string $event, arr
$nodeID = -1;
try {
$nodeID = $node->getId();
} catch (InvalidPathException | NotFoundException $e) {
} catch (InvalidPathException | NotFoundException) {
}
$command = str_replace('%i', escapeshellarg((string)$nodeID), $command);
}
Expand Down
Loading