mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
bugfix: Add nil check in escapeAllStrings to prevent TypeError when upsert vectors (#3789)
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { isNil } from 'lodash'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Escapes all '-' characters.
|
* Escapes all '-' characters.
|
||||||
* Redis Search considers '-' as a negative operator, hence we need
|
* Redis Search considers '-' as a negative operator, hence we need
|
||||||
@@ -8,6 +10,10 @@ export const escapeSpecialChars = (str: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const escapeAllStrings = (obj: object) => {
|
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) => {
|
Object.keys(obj).forEach((key: string) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let item = obj[key]
|
let item = obj[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user