Files
orca/src/shared/shell-path-quoting.ts
T
NeilandWooseong Kim 2b716f601d fix(mobile): attach Codex images when agent identity is missing (#31370)
Use the shared desktop image-path formatter for unidentified mobile terminals and identified Codex, preserving owned agent identity, bracketed paste, upload routing and acknowledged-input ordering.

Adapted from community PR #30310 by Wooseong Kim (@innocarpe). Fixes #30298.

Validation includes exact-head CI and aggregate gate, native macOS and Windows consumer checks, actual paired Windows uploads with byte-integrity checks, and combined mobile/desktop tests, types, lint and bundle checks.

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
2026-10-21 15:31:55 -07:00

14 lines
621 B
TypeScript

import { quotePosixShellUnlessPlain } from './shell-argument-quoting'
// Why: escape rules are a property of the *target* shell receiving the path,
// not the client OS. A Windows client dropping onto a Linux SSH worktree must
// produce POSIX-quoted output; passing a userAgent string here coupled escape
// rules to the client and silently misquoted cross-platform SSH drops.
export function shellEscapePath(path: string, targetShell: 'posix' | 'windows'): string {
if (targetShell === 'windows') {
return /^[a-zA-Z0-9_./@:\\-]+$/.test(path) ? path : `"${path}"`
}
return quotePosixShellUnlessPlain(path)
}