Skip to content

Commit 9f135fc

Browse files
Fix incomplete string escaping
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent fec0aaa commit 9f135fc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/common/escapeKey.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
export function escapeKey(key: string): string {
2-
return key.replaceAll(/{/g, "\\{");
2+
// Escape all backslashes first
3+
key = key.replace(/\\/g, "\\\\");
4+
// Then escape curly braces
5+
return key.replace(/[{]/g, "\\{");
36
}

0 commit comments

Comments
 (0)