Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/internal/win/powershell.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ export function getQuoteFunction() {
* @returns {function(string): string} A function to protect against flag injection.
*/
export function getFlagProtectionFunction() {
const leadingHyphensAndSlashes = new RegExp(/^(?:`?-+|\/+)/);
const leadingHyphensAndSlashes = new RegExp(/^(?:-+|\/+)/);
return (arg) => arg.replace(leadingHyphensAndSlashes, "");
}
26 changes: 26 additions & 0 deletions test/fixtures/win.js
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,32 @@ export const flag = {
expected: { unquoted: "a=b", quoted: "'a=b'" },
},
],
"hyphen (-) + backtick (`)": [
{
input: "`-a",
expected: { unquoted: "`-a", quoted: "'`-a'" },
},
{
input: "`-a=b",
expected: { unquoted: "`-a=b", quoted: "'`-a=b'" },
},
{
input: "`--a",
expected: { unquoted: "`--a", quoted: "'`--a'" },
},
{
input: "`--a=b",
expected: { unquoted: "`--a=b", quoted: "'`--a=b'" },
},
{
input: "`---a",
expected: { unquoted: "`---a", quoted: "'`---a'" },
},
{
input: "`---a=b",
expected: { unquoted: "`---a=b", quoted: "'`---a=b'" },
},
],
"forward slash (/)": [
{
input: "/a",
Expand Down
Loading