1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix escape (#927)

This commit is contained in:
mihaisc 2021-10-20 04:23:05 -07:00 committed by GitHub
parent e993114f51
commit fdcf72b067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ function getSortType(sortParam: string): string {
}
export function escapeESReservedChars(text: string): string {
return text.replace(/([!*+\-=<>&|()\\[\]{}^~?:\\/"])/g, '\\$1')
return text?.replace(/([!*+\-=<>&|()\\[\]{}^~?:\\/"])/g, '\\$1')
}
export function getSearchQuery(
@ -64,8 +64,9 @@ export function getSearchQuery(
serviceType?: string,
accessType?: string
): any {
const emptySearchTerm = text === undefined || text === ''
text = escapeESReservedChars(text)
const emptySearchTerm = text === undefined || text === ''
let searchTerm = owner
? `(publicKey.owner:${owner})`
: tags