diff options
author | Robin Appelman <robin@icewind.nl> | 2020-07-10 14:18:40 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-07-10 14:18:40 +0200 |
commit | e357d46863e02bb896185fc4604d05e51f7b4422 (patch) | |
tree | 7a1478b1130692f4cada7e38d0e3110dac4424c8 /apps/files_external/lib | |
parent | 18acb137d3b973f04ee039fd4a4e8ed1bca25127 (diff) | |
download | nextcloud-server-e357d46863e02bb896185fc4604d05e51f7b4422.tar.gz nextcloud-server-e357d46863e02bb896185fc4604d05e51f7b4422.zip |
filter files containing a hash in the path for ftp storages
the php ftp streamwrapper doesn't handle hashes correctly and will break when it tries to enter a path containing a hash.
By filtering out paths containing a hash we can at least stop the external storage from breaking completely
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FTP.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 2af145ad4a2..d9e5e2a0d5a 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -35,6 +35,7 @@ namespace OCA\Files_External\Lib\Storage; use Icewind\Streams\CallbackWrapper; +use Icewind\Streams\IteratorDirectory; use Icewind\Streams\RetryWrapper; class FTP extends StreamWrapper { @@ -136,6 +137,22 @@ class FTP extends StreamWrapper { return false; } + public function opendir($path) { + $dh = parent::opendir($path); + if (is_resource($dh)) { + $files = []; + while (($file = readdir($dh)) !== false) { + if ($file != '.' && $file != '..' && strpos($file, '#') === false) { + $files[] = $file; + } + } + return IteratorDirectory::wrap($files); + } else { + return false; + } + } + + public function writeBack($tmpFile, $path) { $this->uploadFile($tmpFile, $path); unlink($tmpFile); |