Fix search starting with special characters (#7189)

This commit is contained in:
Yuriy Bakhtin 2024-08-28 12:08:59 +03:00 committed by GitHub
parent 02beaa3e6b
commit f426f94a3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -23,6 +23,7 @@ HumHub Changelog
- Fix #7180: Fix active form on user edit form for correct working of widget inputs
- Fix #7181: Fix duplicated label of checkbox profile field
- Fix #7182: Fix initialization of several select2 inputs on the same page
- Fix #7152: Fix search starting with special characters
1.16.1 (July 1, 2024)
---------------------

View File

@ -315,9 +315,11 @@ humhub.module('ui.additions', function (module, require, $) {
}
if (typeof words === 'string' && words !== '') {
words = words.match(/[^\s]+\/[^\s]+|"[^"]+"|[\p{L}\d]+(?:['`]\p{L}+)?/gu)
.map(item => item.replace(/"/g, ''));
words = [...new Set(words)].sort((a, b) => b.length - a.length);
words = words.match(/[^\s]+\/[^\s]+|"[^"]+"|[\p{L}\d]+(?:['`]\p{L}+)?/gu);
if (Array.isArray(words)) {
words = words.map(item => item.replace(/"/g, ''));
words = [...new Set(words)].sort((a, b) => b.length - a.length);
}
}
if (!Array.isArray(words)) {
return;