Dragging a file from Finder into the terminal silently strips `&` from the path
Summary
Dragging a file whose name contains & from Finder into the Claude Code prompt inserts a path with
the & character removed. The spaces around it are preserved, so Block & Crown.csv becomesBlock Crown.csv (two consecutive spaces). The result looks like a plausible path, so the error is
easy to miss.
Environment
- Claude Code 2.1.228
- macOS 13.7.8 (22H730), Intel
- VS Code integrated terminal 1.133.0 (
TERM_PROGRAM=vscode)
Steps to reproduce
- Create a file with
&in the name, e.g.~/Downloads/Block & Crown.csv - In Claude Code, start typing a message referring to the file
- Drag that file from Finder into the terminal window
- Look at the inserted path
Expected
The path is inserted intact, escaped or quoted as needed — e.g. /Users/me/Downloads/Block\ \&\ Crown.csv
or '/Users/me/Downloads/Block & Crown.csv'.
Actual
The & is dropped and the surrounding spaces kept:
/Users/me/Downloads/Block Crown.csv
Observed twice in one session with two different files (.csv and a .modusdb), both in
directories whose names also survived intact. Only & was affected; spaces were preserved.
Impact
The corrupted path still looks right, so it gets used. Tools that fail silently on a missing file
then produce confidently wrong results rather than an error. In my case sqlite3 was handed the
mangled path and, per its normal behaviour, created a new empty database instead of failing —
queries returned "no such table", and a stray empty file was left in the user's folder. It took a
directory listing to notice the real filename differed.
Music libraries make this quite likely to bite: & is extremely common in artist names
("Block & Crown", "Sly & The Family Stone").
Note on which layer is responsible
I could not determine whether the stripping happens in VS Code's integrated-terminal drop handling
or in Claude Code's own input handling. A quick way to isolate it:
- Drop the same file at a plain shell prompt in the same VS Code terminal (exit Claude Code
first). If the & is still lost, it is VS Code's drop handling, not Claude Code.
- Drop the same file into Claude Code running in Terminal.app or iTerm2. If the
&
survives there, it is specific to the VS Code path.
Happy to run those and report back if useful.