Skip to content

Commit 9023b18

Browse files
authored
fix possible JSON parse error (#326)
1 parent c7457e3 commit 9023b18

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

reverse_engineering/helpers/fetchRequestHelper.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ const filterCorruptedData = (databasesTablesInfoResult, isTruncatedInMiddle) =>
400400
if (isTruncatedInMiddle) {
401401
const warningDelimiter = '*** WARNING: max output size exceeded, skipping output. ***';
402402
const [firstChunk, lastChunk] = databasesTablesInfoResult.split(warningDelimiter);
403-
return [filterCorruptedEnd(firstChunk), filterCorruptedStart(lastChunk)].join(', ');
403+
const filteredFirst = filterCorruptedEnd(firstChunk);
404+
const filteredLast = filterCorruptedStart(lastChunk);
405+
const filteredChunks = [filteredFirst, filteredLast].filter(Boolean);
406+
const joined = filteredChunks.join(JSON_OBJECTS_DELIMITER);
407+
return filteredLast ? joined : joined + '}]}';
404408
}
405409

406410
return filterCorruptedEnd(databasesTablesInfoResult) + '}]}';

0 commit comments

Comments
 (0)