mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 00:10:07 +01:00
Ignore invalid paths (#1478)
This commit is contained in:
@@ -160,6 +160,10 @@ public function sitePath(string $siteName): ?string
|
||||
$domain = static::domainFromSiteName($siteName);
|
||||
|
||||
foreach ($this->config['paths'] as $path) {
|
||||
if (! is_dir($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$handle = opendir($path);
|
||||
|
||||
if ($handle === false) {
|
||||
|
||||
@@ -90,6 +90,13 @@ public function test_it_returns_null_default_site_path_if_not_set()
|
||||
$this->assertNull($server->defaultSitePath());
|
||||
}
|
||||
|
||||
public function test_it_ignores_invalid_paths()
|
||||
{
|
||||
$server = new Server(['paths' => ['fake' => __DIR__.'/invalid_path']]);
|
||||
|
||||
$this->assertNull($server->sitePath('tighten'));
|
||||
}
|
||||
|
||||
public function test_it_tests_whether_host_is_ip_address()
|
||||
{
|
||||
$this->assertTrue(Server::hostIsIpAddress('192.168.1.1'));
|
||||
|
||||
Reference in New Issue
Block a user