Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ All platforms honor the same contract:
| Clipboard: file URL / drop list | ✅ file URL | with CopyQ | ✅ file drop list |
| CLI detection (focused terminal's processes) | `ps -t <tty>` | `/proc` descendants | Win32_Process tree |
| Claude Code → typed `[path] ` | ✅ | ✅ | ✅ |
| Copilot CLI / aider / OpenCode → bare escaped path | ✅ backslash-escaped | ✅ backslash-escaped | quoted if spaces |
| Copilot CLI / aider / OpenCode → bare escaped path | ✅ backslash-escaped | ✅ backslash-escaped | double-quoted if it contains spaces or shell metacharacters; refused if it contains `"`, `$` or `` ` `` |
| Unknown CLI → bracketed default | ✅ | ✅ | ✅ |

The rest of this page documents the **macOS** app.
Expand Down
3 changes: 2 additions & 1 deletion windows/HotshotCapture.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ function Invoke-HotshotInjection {
if ($NoType) { return }
if (-not $Text) {
$refusal = 'injection.control_chars_refused'
if ($ShotPath -notmatch '[\x00-\x1F\x7F\u2028\u2029]' -and (Test-HotshotShellMetacharacters -Path $ShotPath)) {
if ($ShotPath -notmatch '[\x00-\x1F\x7F\u2028\u2029]' -and
((Test-HotshotShellMetacharacters -Path $ShotPath) -or $ShotPath -match '"')) {
$refusal = 'injection.shell_metachars_refused'
}
Write-Warning (Format-HotshotDiagnostic -Severity WARN -Event $refusal `
Expand Down
18 changes: 18 additions & 0 deletions windows/tests/hotshot-capture.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,24 @@ Describe 'Invoke-HotshotInjection' {
"$w" | Should -Be 'hotshot [WARN] injection.shell_metachars_refused: path=<redacted>'
}

It 'warns injection.shell_metachars_refused (not control_chars) for a plain-form path refused for a literal quote' {
$fakes = $script:Fakes
Invoke-HotshotInjection -Text '' -TerminalHandle $script:Hwnd -ShotPath 'C:\Shots\a"b.png' `
@fakes -WarningVariable w -WarningAction SilentlyContinue

$script:Calls.Count | Should -Be 0
"$w" | Should -Be 'hotshot [WARN] injection.shell_metachars_refused: path=<redacted>'
}

It 'labels the $ and backtick plain-form refusals as shell_metachars_refused' {
$fakes = $script:Fakes
foreach ($path in @('C:\Shots\$(id).png', 'C:\Shots\`x`.png')) {
Invoke-HotshotInjection -Text '' -TerminalHandle $script:Hwnd -ShotPath $path `
@fakes -WarningVariable w -WarningAction SilentlyContinue
"$w" | Should -Be 'hotshot [WARN] injection.shell_metachars_refused: path=<redacted>'
}
}

It 'reveals the path in the control_chars_refused warning when verbose logging is on' {
$fakes = $script:Fakes
$env:HOTSHOT_VERBOSE_LOGGING = '1'
Expand Down
Loading