fix: enhance loadJson in LlamaParseReader to handle URL inputs correctly (#1936)

This commit is contained in:
GiftMungmeeprued
2025-05-13 04:10:04 +01:00
committed by GitHub
parent d671ed6d25
commit 40f5f410c0
2 changed files with 12 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/cloud": patch
---
Improve the loadJson function in LlamaParseReader to align with loadData by allowing URL inputs. Ensures s3://, http://, and https:// paths are not treated as local file paths.
+7 -1
View File
@@ -585,7 +585,13 @@ export class LlamaParseReader extends FileReader {
filePathOrContent: string | Uint8Array,
): Promise<Record<string, any>[]> {
let jobId;
const isFilePath = typeof filePathOrContent === "string";
const isFilePath =
typeof filePathOrContent === "string" &&
!(
filePathOrContent.startsWith("s3://") ||
filePathOrContent.startsWith("http://") ||
filePathOrContent.startsWith("https://")
);
try {
const data = isFilePath
? await fs.readFile(filePathOrContent)