diff options
author | Robin Appelman <robin@icewind.nl> | 2020-05-25 15:26:04 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-05-25 15:26:04 +0200 |
commit | 6f2e920a5bf64e5eecb5312f0b5df6c2f7da4e40 (patch) | |
tree | 4f21c061c9d7abc27b076523baa9b3613fe57712 /apps/files_external | |
parent | d26169838eaca3325a3a424082b1c854d3ddc091 (diff) | |
download | nextcloud-server-6f2e920a5bf64e5eecb5312f0b5df6c2f7da4e40.tar.gz nextcloud-server-6f2e920a5bf64e5eecb5312f0b5df6c2f7da4e40.zip |
normalize sftp path in read and write stream
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTPReadStream.php | 3 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTPWriteStream.php | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php index 21ea19517f1..1a721a0e2d8 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php @@ -82,6 +82,9 @@ class SFTPReadStream implements File { public function stream_open($path, $mode, $options, &$opened_path) { [, $path] = explode('://', $path); + $path = '/' . ltrim($path); + $path = str_replace('//', '/', $path); + $this->loadContext('sftp'); if (!($this->sftp->bitmap & SSH2::MASK_LOGIN)) { diff --git a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php index f457992f430..b71dcbb1be5 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php @@ -82,6 +82,9 @@ class SFTPWriteStream implements File { public function stream_open($path, $mode, $options, &$opened_path) { [, $path] = explode('://', $path); + $path = '/' . ltrim($path); + $path = str_replace('//', '/', $path); + $this->loadContext('sftp'); if (!($this->sftp->bitmap & SSH2::MASK_LOGIN)) { |