Skip to content

Commit

Permalink
Ensure keywords string does not exceed database field length
Browse files Browse the repository at this point in the history
The keywords field of the statistics database is only 128 characters
long. If a search keyword with more than 128 chars is used, the 
database insert fails if statistics are enabled.

Fixes: #3321
Ports: #3322
  • Loading branch information
sascha-egerer authored and dkd-kaehm committed Aug 25, 2022
1 parent d322c6e commit 8a4ec95
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ protected function getProcessedKeywords(
): string {
$keywords = $query->getQuery();
$keywords = $this->sanitizeString($keywords);
// Ensure string does not exceed database field length
$keywords = substr($keywords, 0, 128);
if ($lowerCaseQuery) {
$keywords = mb_strtolower($keywords);
}
Expand Down

0 comments on commit 8a4ec95

Please sign in to comment.