Skip to content

Commit 2efafbf

Browse files
ObjectSuggestions: Fix exotic columns match
These columns should only be shown, if expicitely given by user.
1 parent 2913e31 commit 2efafbf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,9 @@ protected function queryTags(Model $model, string $searchTerm): Query
231231

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

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

0 commit comments

Comments
 (0)