Skip to content

Commit

Permalink
fix integration json loading parser so that it will trim unneeded emp…
Browse files Browse the repository at this point in the history
…ty spaces from the ndjson file and match the existing behavior of the savedObject import dashboard that works even when empty spaces appear in the ndjson file

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
  • Loading branch information
YANG-DB committed Jul 26, 2023
1 parent 4499699 commit a6704a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/adaptors/integrations/repository/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class Integration {
);
try {
const ndjson = await fs.readFile(sobjPath, { encoding: 'utf-8' });
const asJson = '[' + ndjson.replace(/\n/g, ',') + ']';
const asJson = '[' + ndjson.trim().replace(/\n/g, ',') + ']';
const parsed = JSON.parse(asJson);
result.savedObjects = parsed;
} catch (err: any) {
Expand Down

0 comments on commit a6704a6

Please sign in to comment.