From 9edf905939de9d59d7b23f8320f84f8350cd0720 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 26 Jun 2014 20:41:43 -0500 Subject: [PATCH] SCP: add support for file names with spaces --- phpseclib/Net/SCP.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SCP.php b/phpseclib/Net/SCP.php index 2796a355..7cf567ee 100644 --- a/phpseclib/Net/SCP.php +++ b/phpseclib/Net/SCP.php @@ -170,7 +170,9 @@ class Net_SCP return false; } - if (!$this->ssh->exec('scp -t ' . $remote_file, false)) { // -t = to + $filename = strpos($remote_file, ' ') !== false ? '"' . $remote_file . '"' : $remote_file; + + if (!$this->ssh->exec('scp -t ' . $filename, false)) { // -t = to return false; } @@ -245,7 +247,9 @@ class Net_SCP return false; } - if (!$this->ssh->exec('scp -f ' . $remote_file, false)) { // -f = from + $filename = strpos($remote_file, ' ') !== false ? '"' . $remote_file . '"' : $remote_file; + + if (!$this->ssh->exec('scp -f ' . $filename, false)) { // -f = from return false; }