Filter out empty rsync command arguments (#3686)

Fixes #3683
This commit is contained in:
Corey Worrell 2023-09-12 07:16:27 -07:00 committed by GitHub
parent 266554d3c7
commit 0cf5d18591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,12 @@ class Rsync
if (!is_array($source)) {
$source = [$source];
}
$command = array_merge(['rsync', $flags], $options, $source, [$destination]);
$command = array_filter(
array_merge(['rsync', $flags], $options, $source, [$destination]),
function (string $value) {
return $value !== '';
},
);
$commandString = $command[0];
for ($i = 1; $i < count($command); $i++) {