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

(cherry picked from commit a0a62af)

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 711a71f)
  • Loading branch information
opensearch-trigger-bot[bot] authored and A9 Swift Project User committed Sep 28, 2023
1 parent 266ae6e commit 962e0e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions auto_sync_commit_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"last_github_commit": "1342df021fca66d1187b2fb84e01c61c50ab469a",
"last_gitfarm_commit": "5a804795b2be1b07610a02ffd52b198fcc985e29"
"last_github_commit": "711a71fcb348713ef6a02feea968a3a78d1b5d57",
"last_gitfarm_commit": "e564e78330a8e9876e41c834275e9ef784a1b192"
}
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 962e0e5

Please sign in to comment.