From 2efafbfee9426b47c61257ff68ebb0e0d6a8861e Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 24 Jun 2024 08:53:27 +0200 Subject: [PATCH] ObjectSuggestions: Fix exotic columns match These columns should only be shown, if expicitely given by user. --- .../Web/Control/SearchBar/ObjectSuggestions.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php b/library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php index 956bd378c..04e083339 100644 --- a/library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php +++ b/library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php @@ -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);