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

Merge pull request #952 from drbyte/case-sensitive

Allow serving mixed case folders on case sensitive file systems
This commit is contained in:
Matt Stauffer
2020-11-18 08:29:39 -05:00
committed by GitHub

View File

@@ -123,19 +123,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);
}
}