Skip to content

Commit

Permalink
Ensure the domain detection only returns the locale if it is unambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
Danae Miller-Clendon committed May 15, 2020
1 parent 7bd139c commit 6182ea0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Middleware/DetectLocaleMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ protected function getDomainLocale()

// If the current domain has exactly one locale, the locale is non-ambiguous
$locales = Locale::getCached()->filter('DomainID', $domainObj->ID);
/** @var Locale $localeObject */
$localeObject = $locales->first();
if ($localeObject) {
return $localeObject->getLocale();
if ($locales->count() == 1) {
/** @var Locale $localeObject */
$localeObject = $locales->first();
if ($localeObject) {
return $localeObject->getLocale();
}
}

return null;
Expand Down

0 comments on commit 6182ea0

Please sign in to comment.