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 (#758)

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
(cherry picked from commit a0a62af)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Aug 4, 2023
1 parent 1342df0 commit 9eabd88
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 9eabd88

Please sign in to comment.