Potential fix for code scanning alert no. 1692: Incomplete string escaping or encoding (#23895)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Ushran Gouhar 2025-10-15 14:36:34 +05:30 committed by GitHub
parent 3c527ca83b
commit e5f8ea2925
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -314,7 +314,7 @@ export const jsonToCSV = <T extends JSONRecord>(
}
const escaped =
typeof value === 'string'
? value.replace(/"/g, '\\"')
? value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
: value.toString(); // handle quotes in content
return `"${escaped}"`; // wrap each field in quotes