mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 16:50:09 +01:00
solution for only remove the tld if it is at the end of the site name
o check if tld is at the end of the site name and if so remove it o added corresponding test
This commit is contained in:
@@ -208,7 +208,10 @@ public function getSiteUrl($directory)
|
||||
$directory = $this->host(getcwd());
|
||||
}
|
||||
|
||||
$directory = str_replace('.'.$tld, '', $directory); // Remove .tld from sitename if it was provided
|
||||
$length = strlen('.'.$tld);
|
||||
if (substr($directory, -$length) === '.'.$tld) {
|
||||
$directory = substr($directory, 0, -$length); // Remove .tld from sitename if it was provided
|
||||
}
|
||||
|
||||
if (! $this->parked()->merge($this->links())->where('site', $directory)->count() > 0) {
|
||||
throw new DomainException("The [{$directory}] site could not be found in Valet's site list.");
|
||||
|
||||
Reference in New Issue
Block a user