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:
19
server.php
19
server.php
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user