From f426f94a3bc4240ecc2cabc5c309141b51b8e509 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Wed, 28 Aug 2024 12:08:59 +0300 Subject: [PATCH] Fix search starting with special characters (#7189) --- CHANGELOG.md | 1 + static/js/humhub/humhub.ui.additions.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b5ca3e311..1397cebb8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) --------------------- diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js index ca64379b24..a81064107c 100644 --- a/static/js/humhub/humhub.ui.additions.js +++ b/static/js/humhub/humhub.ui.additions.js @@ -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;