From 917fcd125ab8bb86f6a8184a69a63b1e0e9facba Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 30 Oct 2024 16:27:10 -0600 Subject: [PATCH] Fix compilable assets when using a mirrored public folder When using a mirrored public folder (i.e. `artisan winter:mirror public`), the working directory for the request is set to base_path('public') instead of base_path(), so it is important to use absolute paths when calling File::exists() as it internally just calls file_exists(), which uses the current working directory to resolve relative paths. Related: - https://github.com/wintercms/storm/commit/752c16253ca7945e68423e91aa0e8ecbeb4fa064#diff-58c1a5c5e22fc25e75bb02e4af9d2085cfe66b8cfe7c3cffc2f32a4fb60240aaR31 - https://github.com/laravel/framework/issues/45679 - https://github.com/laravel/framework/issues/13243 --- modules/system/classes/asset/PackageManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/system/classes/asset/PackageManager.php b/modules/system/classes/asset/PackageManager.php index bf84d147d..2d38e409d 100644 --- a/modules/system/classes/asset/PackageManager.php +++ b/modules/system/classes/asset/PackageManager.php @@ -307,7 +307,7 @@ public function registerPackage(string $name, string $path, string $type = 'mix' } // Check that the package path exists - if (!File::exists($path)) { + if (!File::exists(base_path($path))) { throw new SystemException(sprintf( 'Cannot register "%s" as a compilable package; the "%s" path does not exist.', $name, @@ -318,7 +318,7 @@ public function registerPackage(string $name, string $path, string $type = 'mix' $package = $path . '/package.json'; $config = $path . DIRECTORY_SEPARATOR . $configFile; - if (!File::exists($config)) { + if (!File::exists(base_path($config))) { throw new SystemException(sprintf( 'Cannot register "%s" as a compilable package; the config file "%s" does not exist.', $name,