Skip to content

Commit

Permalink
fix: Correct the check condition
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Nov 6, 2023
1 parent 0ae7e6a commit d080d42
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions system/Commands/Utilities/Routes/FilterFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ public function find(string $uri): array
{
$this->filters->reset();

$isLocaleExist = strpos($uri, '{locale}') !== false;
// Fix for the search filters command
$isSupportedLocaleOnly = false;

if (strpos($uri, '{locale}') !== false && Services::routes()->shouldUseSupportedLocalesOnly()) {
$isSupportedLocaleOnly = true;

if ($isLocaleExist) {
$uri = str_replace('{locale}', config(App::class)->defaultLocale, $uri);
}

Expand All @@ -73,7 +76,7 @@ public function find(string $uri): array

$filters = $this->filters->getFilters();

if ($isLocaleExist) {
if ($isSupportedLocaleOnly) {
$filters['before'] = array_map(static fn ($filter) => '!' . $filter, $filters['before']);
$filters['after'] = array_map(static fn ($filter) => '!' . $filter, $filters['after']);
}
Expand Down

0 comments on commit d080d42

Please sign in to comment.