Repository navigation
Comparing changes
Open a pull request
base repository: ljharb/shell-quote
base: v1.10.0
head repository: ljharb/shell-quote
compare: v1.11.0
- 15 commits
- 11 files changed
- 4 contributors
Commits on Jul 14, 2026
-
[Fix]
quote: escape~in glob patterns to prevent shell tilde-exp……ansion `GLOB_SHELL_SPECIAL` omitted `~`, so a `{ op: 'glob', pattern }` token emitted a leading tilde unescaped and the shell expanded it to an absolute path. The omission was inherited, not chosen: the glob branch (4378a6e, v1.8.4) was written a month before `~` was added to the string branch (v1.9.0, #9), when neither class escaped it, and was never revisited. The resulting inconsistency was observable in the round-trip - `quote(parse('cat ~/foo.txt'))` already yielded `cat \~/foo.txt`, while `quote(parse('cat ~/*.txt'))` yielded `cat ~/*.txt` unchanged, so adding a glob character silently decided whether `~` expanded. Tilde expansion is a shell word-expansion, not a glob metacharacter, so escaping it costs no pattern-matching fidelity: `sh -c 'echo \~x*'` still matches files literally named `~x`. Glob metacharacters continue to pass through unescaped. `{`, `}`, and `,` are deliberately left alone: brace patterns are glob syntax to minimatch/node-glob, and their pass-through is pinned by an existing test.Configuration menu - View commit details
-
Copy full SHA for 239d49c - Browse repository at this point
Copy the full SHA 239d49cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6de9a41 - Browse repository at this point
Copy the full SHA 6de9a41View commit details
Commits on Jul 15, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 3429b0d - Browse repository at this point
Copy the full SHA 3429b0dView commit details -
[Fix]
quote: preserve empty glob patterns`{ op: 'glob', pattern: '' }` emitted an empty string, which `join(' ')` then collapsed, so the token silently vanished from the output: three tokens in, two arguments out. The `s === ''` check only ever tested raw string tokens, never `s.pattern`. Emit `''` instead, matching what a bare empty string token already does, so the token keeps its argv slot.Configuration menu - View commit details
-
Copy full SHA for 35c9b97 - Browse repository at this point
Copy the full SHA 35c9b97View commit details
Commits on Sep 10, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 36f2394 - Browse repository at this point
Copy the full SHA 36f2394View commit details
Commits on Sep 27, 2026
-
[Fix]
parse: preserve text after special shell parametersThe special-parameter branch of `parseEnvVar` advanced the scanner once too many, so the character right after `$?`, `$#`, `$$`, `$-`, `$!`, `$*`, or `$@` was dropped: `parse('$?suffix', { '?': '1' })` returned `['1uffix']`. When that character was an opening quote, the rest of the word was unquoted: `$?"a;b"` parsed as a bogus `{ op }` token, and `$?'#x' y` swallowed `y` into a comment.Configuration menu - View commit details
-
Copy full SHA for 81b08a5 - Browse repository at this point
Copy the full SHA 81b08a5View commit details -
[Fix]
parse: treat$_nameas a variable name, not$_followed b……y text `_` is a name character in POSIX shells, so `$_foo` is the variable `_foo`, not `$_` followed by `foo`. The special-parameter class included `_`, which split the name after one character. Without `_` in that class, the identifier branch reads the whole name, and a bare `$_` still resolves to `_`.
Configuration menu - View commit details
-
Copy full SHA for 28f88cd - Browse repository at this point
Copy the full SHA 28f88cdView commit details -
[Fix]
quote: reject line terminators in tokens after acommentA `{ comment }` token emits `#...`, which comments out the rest of the line, including the opening quote of any later string token. A line terminator inside that later string ends the comment, and the rest of the string is parsed as shell input: `quote(['echo', { comment: 'x' }, 'a\nid;#'])` runs `id` in sh, bash, zsh, ksh, and dash. `parse` emits a comment for a mid-word `#` (e.g. `http://x/#frag`), so appending tokens to `parse` output is enough to reach it. The line-terminator check added for `comment` in 4378a6e only covered the comment's own text. Now any string after a comment is checked with the same line-terminator set. Tokens after a comment without line terminators are unchanged.Configuration menu - View commit details
-
Copy full SHA for 6002b2e - Browse repository at this point
Copy the full SHA 6002b2eView commit details
Commits on Sep 28, 2026
-
[Fix]
quote: preserve!in arguments that also contain'An argument containing `'` is double-quoted, where `!` was escaped as `\!`. Inside double quotes, POSIX shells keep that backslash (sh, bash, dash, ksh, and zsh, when non-interactive), so `quote(["O'Brien!"])` produced `O'Brien\!`. Such arguments are now single-quoted, with each `'` written as `'"'"'` (as Python's `shlex.quote` does), so `!` needs no escape and is not history-expanded in interactive shells. No double-quoted output contains `!` anymore, so it is dropped from that branch's escape class. The existing test/quote.js assertion changed here pinned the corrupt output.
Configuration menu - View commit details
-
Copy full SHA for ad39927 - Browse repository at this point
Copy the full SHA ad39927View commit details -
Configuration menu - View commit details
-
Copy full SHA for b1e406e - Browse repository at this point
Copy the full SHA b1e406eView commit details -
[Fix]
parse: an escaped backslash does not escape the character aft……er it The chunker never paired `\\`, so it treated the second backslash as escaping the next character, while the scanner, like bash, pairs them. Unquoted, `a\\ b` parsed as one word, and `a\;echo b` and `x\\|cat` returned a malformed `{ op }` token that hid the operator. Inside double quotes, the pattern could run past a closing `"` that followed `\\` whenever another `"` came later, so `"a\\" "b"` parsed as one word and `"a\\";echo "b"` as one malformed `{ op }`. Pair escaped characters in barewords, including the escape character itself, and build the double-quote pattern from the escape character, as `BAREWORD` already is, with disjoint alternatives (an escape pairs with any next character), as the scanner does.Configuration menu - View commit details
-
Copy full SHA for d708019 - Browse repository at this point
Copy the full SHA d708019View commit details -
[New]
parse: support bash ANSI-C quoting ($'...')`parse` now decodes bash ANSI-C quoted strings, the form Chrome/Edge DevTools emit from "Copy as cURL (bash)" (e.g. `--data-raw $'...'`). Previously the `$` was kept, escapes were not decoded, and an escaped quote (`\'`) ended the string early. Escapes are decoded as bash does (`\n`, `\t`, `\'`, `\"`, `\\`, `\a`, `\b`, `\e`, `\E`, `\f`, `\r`, `\v`, `\?`, `\nnn`, `\xHH`, `\uHHHH`, `\UHHHHHHHH`, `\cx`); an unrecognized escape keeps its backslash, and a NUL ends the string. The contents are never split, globbed, or expanded, and `$'...'` is not special inside other quotes. zsdycs: the feature, its README section, and the original tests. Jordan Harband: the linear-time implementation in `parse.js`, word-boundary and `splitUnquoted` handling, and the added tests. Closes #32 Co-authored-by: zsdycs <mail@lipk.org> Co-authored-by: Jordan Harband <ljharb@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for e455649 - Browse repository at this point
Copy the full SHA e455649View commit details
Commits on Sep 29, 2026
-
[Refactor]
quote: drop a replace that can never match in the single……-quote branch That branch is only reached when the string contains no `'`, so `s.replace(/(['])/g, '\\$1')` was a no-op; output is unchanged for every string. It also encoded the wrong idiom (`\'` does not escape inside single quotes), and CodeQL's `js/incomplete-sanitization` kept flagging it, asking for the backslash escaping that #20 removed to fix #15.
Configuration menu - View commit details
-
Copy full SHA for c4385ec - Browse repository at this point
Copy the full SHA c4385ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for ebfc308 - Browse repository at this point
Copy the full SHA ebfc308View commit details -
Configuration menu - View commit details
-
Copy full SHA for 88241f8 - Browse repository at this point
Copy the full SHA 88241f8View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v1.10.0...v1.11.0