diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx index ba560298129..4d8c5b1638f 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx @@ -201,9 +201,14 @@ function buildSearchQuery(searchText) { * @returns {Promise} If no input text, return a promise which resolve to empty array, else return the API.all response */ function getSuggestions(value) { + // Skip empty and invalid inputs such as queries ending with a colon + if (value.trim().length === 0 || /:(\s+|(?![\s\S]))/g.test(value)) { + return new Promise((resolve) => resolve({ obj: { list: [] } })); + } + const modifiedSearchQuery = buildSearchQuery(value); - if (value.trim().length === 0 || !modifiedSearchQuery) { + if (!modifiedSearchQuery) { return new Promise((resolve) => resolve({ obj: { list: [] } })); } else { return API.search({ query: modifiedSearchQuery, limit: 8 });