1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00

Allow serving mixed case folders on case sensitive file systems

Fixes #622
This commit is contained in:
Chris Brown
2020-05-22 12:41:00 -04:00
parent ea45fcc80a
commit 22443d1e71

View File

@@ -108,19 +108,24 @@ function valet_default_site_path($config)
/**
* Determine the fully qualified path to the site.
* Inspects registered path directories, case-sensitive.
*/
$valetSitePath = null;
$domain = array_slice(explode('.', $siteName), -1)[0];
foreach ($valetConfig['paths'] as $path) {
if (is_dir($path.'/'.$siteName)) {
$valetSitePath = $path.'/'.$siteName;
break;
}
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (! is_dir($path.'/'.$file)) continue;
if (in_array($file, ['.', '..', '.DS_Store'])) continue;
if (is_dir($path.'/'.$domain)) {
$valetSitePath = $path.'/'.$domain;
break;
// match dir for lowercase, because Nginx only tells us lowercase names
if (strtolower($file) === $siteName || strtolower($file) === $domain) {
$valetSitePath = $path.'/'.$file;
break;
}
}
closedir($handle);
}
}