From c71c836dfad75d9f1860fb3fbe38c01a73ada065 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 6 May 2024 05:33:00 +0300 Subject: [PATCH] delegate is_readable validation out of _realpath method --- src/Model/Filesystem.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Model/Filesystem.php b/src/Model/Filesystem.php index 10eb2a0..e6b9136 100644 --- a/src/Model/Filesystem.php +++ b/src/Model/Filesystem.php @@ -42,6 +42,14 @@ class Filesystem ); } + // Root is readable + if (!is_readable($realpath)) + { + throw new \Exception( + _('root path is not readable!') + ); + } + // Check root path does not contain hidden context if (str_contains($realpath, DIRECTORY_SEPARATOR . '.')) { @@ -240,11 +248,6 @@ class Filesystem return null; } - if (!is_readable($realpath)) - { - return null; - } - if (is_dir($realpath)) { $realpath = rtrim(