Chore/JSON Array (#5467)

* add separate by JSON object

* add file check for Unstructured

* Enhance JSON DocumentLoader: Update label and description for 'Separate by JSON Object' option, and add type check for JSON objects in array processing.
This commit is contained in:
Henry Heng
2025-11-13 11:11:39 +00:00
committed by GitHub
parent 94cae3b66f
commit ceb0512e2f
2 changed files with 68 additions and 15 deletions
@@ -10,7 +10,7 @@ import {
import { getCredentialData, getCredentialParam, handleEscapeCharacters } from '../../../src/utils'
import { getFileFromStorage, INodeOutputsValue } from '../../../src'
import { UnstructuredLoader } from './Unstructured'
import { isPathTraversal } from '../../../src/validator'
import { isPathTraversal, isUnsafeFilePath } from '../../../src/validator'
import sanitize from 'sanitize-filename'
import path from 'path'
@@ -565,7 +565,7 @@ class UnstructuredFile_DocumentLoaders implements INode {
throw new Error('Invalid file path format')
}
if (isPathTraversal(filePath)) {
if (isPathTraversal(filePath) || isUnsafeFilePath(filePath)) {
throw new Error('Invalid path characters detected in filePath - path traversal not allowed')
}