summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-06-03 12:17:38 +0200
committerGitHub <noreply@github.com>2020-06-03 12:17:38 +0200
commit33f6a26a7da285509358794d4ab9110c1b065a5f (patch)
treeb74c22744ffd2d44b4adfc411e85348edc5ab28f /apps/files_external
parent111c8c9e0e229777d984800fe7e6c58dd15dc1f4 (diff)
parent6f2e920a5bf64e5eecb5312f0b5df6c2f7da4e40 (diff)
downloadnextcloud-server-33f6a26a7da285509358794d4ab9110c1b065a5f.tar.gz
nextcloud-server-33f6a26a7da285509358794d4ab9110c1b065a5f.zip
Merge pull request #21091 from nextcloud/sftp-normalize-path
normalize sftp path in read and write stream
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)) {