Skip to content

Commit

Permalink
Escape more chars
Browse files Browse the repository at this point in the history
  • Loading branch information
vcheung-stripe committed Dec 3, 2024
1 parent 85f290b commit eadf574
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Binary file added jdt-language-server-latest.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
},
"stripe.projectName": {
"type": "string",
"description": "the project name to read from for config (default \"default\")"
"description": "the project name to read from for config (default \"default\")",
"pattern": "^[a-zA-Z0-9_-\\s]+$"
},
"stripe.telemetry.enabled": {
"type": "boolean",
Expand Down
27 changes: 17 additions & 10 deletions src/stripeTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,30 @@ export class StripeTerminal {
'stripe',
new vscode.ShellExecution(cliPath, [
command,
...args.map((arg) => ({
quoting: vscode.ShellQuoting.Strong,
value: arg,
})),
...globalCLIFlags.map((arg) => ({
quoting: vscode.ShellQuoting.Strong,
value: arg,
})),
])
...args,
...globalCLIFlags
],
{
shellQuoting: {
escape: {
escapeChar: '\\',
charsToEscape: '&`|"\'',
}
}
}
)
));
}

// The Stripe CLI supports a number of flags for every command. See https://stripe.com/docs/cli/flags
private getGlobalCLIFlags(): Array<string> {
const stripeConfig = vscode.workspace.getConfiguration('stripe');

const projectName = stripeConfig.get('projectName', null);
let projectName = stripeConfig.get<string | null>('projectName', null);
if (projectName !== null) {
projectName = projectName.replace(/[\\"'`]/g, '');
}
console.log({projectName});

const projectNameFlag = projectName ? ['--project-name', projectName] : [];

Expand Down

0 comments on commit eadf574

Please sign in to comment.