diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-05-12 21:00:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 21:00:27 +0200 |
commit | eb45a6ca404524bad6416ba3b3a755f9faa5e9b8 (patch) | |
tree | 18b003bb713ea4cbcf5828daacf49f4a474c16d9 /lib | |
parent | febbd21814d027f7df4af6ee9f35816a47f25fcd (diff) | |
parent | 1c97611fa245c9dc710e768015f1021a440eb833 (diff) | |
download | nextcloud-server-eb45a6ca404524bad6416ba3b3a755f9faa5e9b8.tar.gz nextcloud-server-eb45a6ca404524bad6416ba3b3a755f9faa5e9b8.zip |
Merge pull request #32008 from nextcloud/fix/getSize-bool
Fix Call to a member function getSize() on bool
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/legacy/OC_Files.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 41ac20577b2..02e15fd08d5 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -145,21 +145,26 @@ class OC_Files { } self::lockFiles($view, $dir, $files); + $numberOfFiles = 0; + $fileSize = 0; /* Calculate filesize and number of files */ if ($getType === self::ZIP_FILES) { $fileInfos = []; - $fileSize = 0; foreach ($files as $file) { $fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $file); - $fileSize += $fileInfo->getSize(); - $fileInfos[] = $fileInfo; + if ($fileInfo) { + $fileSize += $fileInfo->getSize(); + $fileInfos[] = $fileInfo; + } } $numberOfFiles = self::getNumberOfFiles($fileInfos); } elseif ($getType === self::ZIP_DIR) { $fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $files); - $fileSize = $fileInfo->getSize(); - $numberOfFiles = self::getNumberOfFiles([$fileInfo]); + if ($fileInfo) { + $fileSize = $fileInfo->getSize(); + $numberOfFiles = self::getNumberOfFiles([$fileInfo]); + } } $streamer = new Streamer(\OC::$server->getRequest(), $fileSize, $numberOfFiles); |