summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-05-25 15:26:04 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-06-03 10:19:35 +0000
commit48c0ac2f12bfac616214de88442891ee43a0ee08 (patch)
treec5dbeb7cf26b9fbe00017f5e5dba2efd459a67d1 /apps/files_external
parentf431c145bcf9fa9e8d45cf7e0d95b90ea4112241 (diff)
downloadnextcloud-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.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/SFTPWriteStream.php3
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)) {