Skip to content

Commit 320cf38

Browse files
betegonclaude
andcommitted
fix: reorder & metacharacter check after multi-char operators
Move single-char `&` pattern right after `&&`, `||`, `|` so multi-char operators are checked before their single-char prefixes, matching the stated design principle in the comment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2328b0f commit 320cf38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/init/local-ops.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const SHELL_METACHARACTER_PATTERNS: Array<{ pattern: string; label: string }> =
5252
{ pattern: "&&", label: "command chaining (&&)" },
5353
{ pattern: "||", label: "command chaining (||)" },
5454
{ pattern: "|", label: "piping (|)" },
55+
{ pattern: "&", label: "background execution (&)" },
5556
{ pattern: "`", label: "command substitution (`)" },
5657
{ pattern: "$(", label: "command substitution ($()" },
5758
{ pattern: "(", label: "subshell/grouping (()" },
@@ -64,7 +65,6 @@ const SHELL_METACHARACTER_PATTERNS: Array<{ pattern: string; label: string }> =
6465
{ pattern: "\r", label: "carriage return" },
6566
{ pattern: ">", label: "redirection (>)" },
6667
{ pattern: "<", label: "redirection (<)" },
67-
{ pattern: "&", label: "background execution (&)" },
6868
// Glob and brace expansion — brace expansion is the real risk
6969
// (e.g. `npm install {evil,@sentry/node}`)
7070
{ pattern: "{", label: "brace expansion ({)" },

0 commit comments

Comments
 (0)