From 1304f2717deaaf1a0a2dd6ba7dfea917a9eae4ba Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Wed, 5 Feb 2025 11:54:53 +0000 Subject: [PATCH] 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`. --- packages/eas-cli/src/utils/json.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eas-cli/src/utils/json.ts b/packages/eas-cli/src/utils/json.ts index 4f66f14ebc..878a82f749 100644 --- a/packages/eas-cli/src/utils/json.ts +++ b/packages/eas-cli/src/utils/json.ts @@ -33,6 +33,8 @@ function sanitizeValue(value: any): unknown { } }); return result; + } else if (value && typeof value === 'string') { + return JSON.stringify(value) } else { return value; }