Skip to content

Commit

Permalink
CODEGEN-248 escape special characters for curl codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-v-singh committed Apr 17, 2024
1 parent 8a20a74 commit 40b6cd7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions codegens/curl/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ var self = module.exports = {
inputString = inputString.replace(/"/g, '\\"');
// Escape backslash if double quote was already escaped before call to sanitize
inputString = inputString.replace(/(?<!\\)\\\\"/g, '\\\\\\"');

// Escape special characters to preserve their literal meaning within double quotes
inputString = inputString.replace(/`/g, '\\`');
inputString = inputString.replace(/\$/g, '\\$');
inputString = inputString.replace(/!/g, '\\!');
}
else if (quoteType === '\'') {
// for curl escaping of single quotes inside single quotes involves changing of ' to '\''
Expand Down

0 comments on commit 40b6cd7

Please sign in to comment.