diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-07-13 10:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 10:56:16 +0200 |
commit | 7569bc15bdf0959f1ecc4461954c0dfab93053cf (patch) | |
tree | d0bb133a0c276618942248ca1d36ff06483cf370 /apps | |
parent | a8cc99bd53710d4a49dd1ed13fa13c5434ad79c0 (diff) | |
parent | e357d46863e02bb896185fc4604d05e51f7b4422 (diff) | |
download | nextcloud-server-7569bc15bdf0959f1ecc4461954c0dfab93053cf.tar.gz nextcloud-server-7569bc15bdf0959f1ecc4461954c0dfab93053cf.zip |
Merge pull request #21789 from nextcloud/ftp-filter-hash
filter files containing a hash in the path for ftp storages
Diffstat (limited to 'apps')
-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); |