diff --git a/lib/Controller/OtherController.php b/lib/Controller/OtherController.php index 94f7ce56..6eabe9bf 100644 --- a/lib/Controller/OtherController.php +++ b/lib/Controller/OtherController.php @@ -264,20 +264,18 @@ class OtherController extends GenericApiController bool $testIfFile = true, bool $testIfExecutable = true ): string { - if ($path instanceof \Closure) { - try { - $path = $path(); - } catch (\Exception $e) { - return 'test_fail:'.$e->getMessage(); + if ($testIfFile) { + if ($path instanceof \Closure) { + try { + $path = $path(); + } catch (\Exception $e) { + return 'test_fail:'.$e->getMessage(); + } } - } - if (!\is_string($path)) { - return 'not_found'; - } - - if ($testIfFile && !is_file($path)) { - return 'not_found'; + if (!\is_string($path) || !is_file($path)) { + return 'not_found'; + } } if ($testIfExecutable && !is_executable($path)) { diff --git a/lib/Service/BinExt.php b/lib/Service/BinExt.php index 7c0e836d..18aebd1a 100644 --- a/lib/Service/BinExt.php +++ b/lib/Service/BinExt.php @@ -33,7 +33,7 @@ class BinExt if ($copy) { if (empty($path)) { - throw new \Exception('binary path is empty (run occ maintenance:repair)'); + throw new \Exception('binary path is empty (run occ maintenance:repair or use system perl)'); } if (!copy($path, $target)) {