From e580c16ccd29df437d2b044392c04b3f3ab708f9 Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 26 Apr 2023 10:49:00 +0200 Subject: [PATCH] Shares: improved empty folder checking --- plugins/dynamix/include/ShareList.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/dynamix/include/ShareList.php b/plugins/dynamix/include/ShareList.php index f41be7f7c..ba2724852 100644 --- a/plugins/dynamix/include/ShareList.php +++ b/plugins/dynamix/include/ShareList.php @@ -14,8 +14,7 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'; if (isset($_POST['scan'])) { - $scan = $_POST['scan']; - die(is_dir("/mnt/user/$scan") ? (count(scandir("/mnt/user/$scan",SCANDIR_SORT_NONE))<=2 ? '1' : '0') : '1'); + die((new \FilesystemIterator("/mnt/user/{$_POST['scan']}"))->valid() ? '0' : '1'); } // add translations