]> source.dussan.org Git - nextcloud-server.git/commitdiff
normalize sftp path in read and write stream 21091/head
authorRobin Appelman <robin@icewind.nl>
Mon, 25 May 2020 13:26:04 +0000 (15:26 +0200)
committerRobin Appelman <robin@icewind.nl>
Mon, 25 May 2020 13:26:04 +0000 (15:26 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/lib/Lib/Storage/SFTPReadStream.php
apps/files_external/lib/Lib/Storage/SFTPWriteStream.php

index 21ea19517f1051281c401b58f4847493434d1fd8..1a721a0e2d86ff30504216aef4d02ca1255acc15 100644 (file)
@@ -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)) {
index f457992f4309de1f1c0e64ff4cac5e213ba56a58..b71dcbb1be5f972f0b546fc484140c7ab38f4870 100644 (file)
@@ -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)) {