You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -18,6 +19,37 @@ export class LocalFileStrategy extends JsonIngestionStrategy {
18
19
// Resolve and validate file path - keeping existing logic
19
20
constresolvedPath=resolve(source);
20
21
22
+
// Check file size before reading
23
+
letfileStats;
24
+
try{
25
+
fileStats=awaitfs.stat(resolvedPath);
26
+
}catch(error){
27
+
return{
28
+
success: false,
29
+
error: {
30
+
type: 'file_not_found',
31
+
message: `File not found: ${resolvedPath}`,
32
+
details: error
33
+
}
34
+
};
35
+
}
36
+
37
+
// Check if file size exceeds limit
38
+
if(fileStats.size>this.maxFileSize){
39
+
return{
40
+
success: false,
41
+
error: {
42
+
type: 'content_too_large',
43
+
message: `File too large (${Math.round(fileStats.size/1024/1024)}MB). This tool is optimized for JSON files under ${Math.round(this.maxFileSize/1024/1024)}MB.`,
0 commit comments