summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/Common.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-17 16:05:52 +0100
committerRobin Appelman <robin@icewind.nl>2022-03-17 22:21:16 +0100
commit84f464550ad632ecbcd1dbe4b9796053047622a7 (patch)
treeac9435f94175ea927305cee49407d3527c6a6d97 /lib/private/Files/Storage/Common.php
parentbf48c0b1b4bd3677a70aa0d7c8a50a5253c4cb5b (diff)
downloadnextcloud-server-84f464550ad632ecbcd1dbe4b9796053047622a7.tar.gz
nextcloud-server-84f464550ad632ecbcd1dbe4b9796053047622a7.zip
some file scanner performance improvements
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Storage/Common.php')
-rw-r--r--lib/private/Files/Storage/Common.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 7239c58a8a1..8e7e56e6ca2 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -52,6 +52,7 @@ use OC\Files\Storage\Wrapper\Jail;
use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Files\EmptyFileNameException;
use OCP\Files\FileNameTooLongException;
+use OCP\Files\ForbiddenException;
use OCP\Files\GenericFileException;
use OCP\Files\InvalidCharacterInPathException;
use OCP\Files\InvalidDirectoryException;
@@ -702,6 +703,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* @inheritdoc
*/
public function getMetaData($path) {
+ if (Filesystem::isFileBlacklisted($path)) {
+ throw new ForbiddenException('Invalid path: ' . $path, false);
+ }
+
$permissions = $this->getPermissions($path);
if (!$permissions & \OCP\Constants::PERMISSION_READ) {
//can't read, nothing we can do
@@ -880,7 +885,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (is_resource($dh)) {
$basePath = rtrim($directory, '/');
while (($file = readdir($dh)) !== false) {
- if (!Filesystem::isIgnoredDir($file) && !Filesystem::isFileBlacklisted($file)) {
+ if (!Filesystem::isIgnoredDir($file)) {
$childPath = $basePath . '/' . trim($file, '/');
$metadata = $this->getMetaData($childPath);
if ($metadata !== null) {