Skip to content

Commit

Permalink
ObjectSuggestions: Fix exotic columns match
Browse files Browse the repository at this point in the history
These columns should only be shown, if expicitely given by user.
  • Loading branch information
sukhwinder33445 committed Jun 24, 2024
1 parent 2913e31 commit 2efafbf
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,9 @@ protected function queryTags(Model $model, string $searchTerm): Query

protected function matchSuggestion($path, $label, $searchTerm)
{
if (preg_match('/[_.](id|uuid)$/', $path)) {
if (preg_match('/[_.](id|uuid)$/', $path, $matches)) {
// Only suggest exotic columns if the user knows about them
$trimmedSearch = trim($searchTerm, ' *');
return substr($path, -strlen($trimmedSearch)) === $trimmedSearch;
return $matches[1] === trim($searchTerm, ' *');
}

return parent::matchSuggestion($path, $label, $searchTerm);
Expand Down

0 comments on commit 2efafbf

Please sign in to comment.