Merge pull request #21203 from nextcloud/backport/21091/stable19

[stable19] normalize sftp path in read and write stream
This commit is contained in:
Roeland Jago Douma 2020-06-08 12:15:00 +02:00 committed by GitHub
commit b876658d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View 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)) {

View 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)) {