mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
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>
14 lines
621 B
TypeScript
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)
|
|
}
|