Skip to content

Commit 1304f27

Browse files
authored
Make sure quotes in json are escaped
I'm seeing issues when I run `eas build:list --json` because git commit messages are included in the result but git commit messages sometimes contain quotes. These aren't escaped and so I am seeing invalid json in the output that looks like this: ``` { \\... "gitCommitMessage": "Changed some "stuff"" } ``` I've changed this so that string values (only) are escaped using `JSON.stringify`.
1 parent b3d0924 commit 1304f27

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/eas-cli/src/utils/json.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ function sanitizeValue(value: any): unknown {
3333
}
3434
});
3535
return result;
36+
} else if (value && typeof value === 'string') {
37+
return JSON.stringify(value)
3638
} else {
3739
return value;
3840
}

0 commit comments

Comments
 (0)