Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix integration json loading parser so that it will trim unneeded emp… #758

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, ',') + ']';
YANG-DB marked this conversation as resolved.
Show resolved Hide resolved
YANG-DB marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented in resovled : If it's simple to test, "how would we possibly break this in the future" is exactly the kind of unknown to test-proof. since this is a data-modifying function, I'd lean toward producing some sort of test.

const parsed = JSON.parse(asJson);
result.savedObjects = parsed;
} catch (err: any) {
Expand Down
Loading