From a11b001968b25d67efcd7d1c6930a9be75b8a134 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 4 Mar 2025 16:39:44 +0800 Subject: [PATCH] bug fix: dir and filename support 0 --- lib/DirScanner.php | 2 +- themes/beauty/controller/ListController.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/DirScanner.php b/lib/DirScanner.php index 4fdbdb0..e0b820c 100644 --- a/lib/DirScanner.php +++ b/lib/DirScanner.php @@ -79,7 +79,7 @@ Class DirScanner { //判断目录名或文件名是否合法 - //不允许包含斜杠/,反斜杠\,单引号',双引号",空格字符 + //不允许包含斜杠/,反斜杠\,单引号',双引号"字符 //忽略.开头的隐藏文件 private function isValid($name) { return str_replace(['/', '\\', "'", '"'], '', $name) == $name && !preg_match('/^\..+/', $name); diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index 9d73377..80f6a1f 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -104,9 +104,9 @@ Class ListController extends Controller { $files = array(); $dir_exts = array(); foreach ($scanResults as $id => $item) { - if (!empty($item['directory'])) { + if (strlen($item['directory']) > 0) { array_push($dirs, $item); - }else if (!empty($item['filename'])) { + }else if (strlen($item['filename']) > 0) { array_push($files, $item); }else { $dir_exts = array_merge($item, $dir_exts);