bugfix: Add nil check in escapeAllStrings to prevent TypeError when upsert vectors (#3789)
This commit is contained in:
parent
9cceba2240
commit
b34a82335d
|
|
@ -1,3 +1,5 @@
|
|||
import { isNil } from 'lodash'
|
||||
|
||||
/*
|
||||
* Escapes all '-' characters.
|
||||
* Redis Search considers '-' as a negative operator, hence we need
|
||||
|
|
@ -8,6 +10,10 @@ export const escapeSpecialChars = (str: string) => {
|
|||
}
|
||||
|
||||
export const escapeAllStrings = (obj: object) => {
|
||||
if (isNil(obj)) {
|
||||
// return if obj is null or undefined to avoid "TypeError: Cannot convert undefined or null to object"
|
||||
return
|
||||
}
|
||||
Object.keys(obj).forEach((key: string) => {
|
||||
// @ts-ignore
|
||||
let item = obj[key]
|
||||
|
|
|
|||
Loading…
Reference in New Issue