diff options
author | Robin Appelman <robin@icewind.nl> | 2020-05-25 15:26:04 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-06-03 10:19:35 +0000 |
commit | 48c0ac2f12bfac616214de88442891ee43a0ee08 (patch) | |
tree | c5dbeb7cf26b9fbe00017f5e5dba2efd459a67d1 /apps/files_external | |
parent | f431c145bcf9fa9e8d45cf7e0d95b90ea4112241 (diff) | |
download | nextcloud-server-48c0ac2f12bfac616214de88442891ee43a0ee08.tar.gz nextcloud-server-48c0ac2f12bfac616214de88442891ee43a0ee08.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)) { |