From 0a11156d49c2020f8744816f021f01ece3bc4205 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 24 Sep 2020 12:31:55 +0200 Subject: [PATCH] remove first character in query string if it is @, ! or # --- backend/src/schema/resolvers/searches/queryString.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/searches/queryString.js b/backend/src/schema/resolvers/searches/queryString.js index 064f17f48..3f2f70d48 100644 --- a/backend/src/schema/resolvers/searches/queryString.js +++ b/backend/src/schema/resolvers/searches/queryString.js @@ -39,7 +39,8 @@ const matchBeginningOfWords = (str) => { } export function normalizeWhitespace(str) { - return str.replace(/\s+/g, ' ').trim() + // delete the first character if it is !, @ or # + return str.replace(/^([!@#])/, '').replace(/\s+/g, ' ').trim() } export function escapeSpecialCharacters(str) {