Repository navigation
Commit 776d8d7
fix: address round-3 cubic findings on #1274 — non-TTY OSC 8 leak, second URL-join duplicate
- `hyperlink()`: skip OSC 8 wrapping entirely (return bare sanitized text)
when stdout isn't a TTY. Stdin can be a TTY (satisfying the handler's
interactive-input check) while stdout is redirected to a file or piped —
in that case no terminal is reading the bytes, so the previous
"harmless when unrecognized" reasoning didn't hold: raw OSC 8 would land
as literal junk in the captured output. `terminalSupportsHyperlinks()`
already checked `isTTY` for the underline decision; this applies the
same check before emitting any escape bytes at all.
- `manageUrlFor`: delegate to `buildManageUrl` instead of its own copy of
the pre-fix string-concatenation bug. Two near-identical URL builders in
the same file had drifted — the first round's fix only touched
`currentManageUrl`'s construction and missed this second one, used by
the browser-handoff and create-flow "Manage it at:" lines.
- Declined (with reasoning in `buildManageUrl`'s comment): moving the
URL-join helper to a module shared with the TUI side. Contradicts this
codebase's existing, documented CLI/TUI self-containment convention
(same rationale as `isSafeHttpUrl`'s deliberate duplication) — the fix
is consolidating within this file, not spanning the boundary.
- Updated `link.test.ts` for `hyperlink()`'s new non-TTY early return, and
added a test isolating "TTY but unrecognized terminal" (OSC 8, no
underline) from "not a TTY at all" (no escape bytes whatsoever) — the
previous tests conflated the two via a shared `isTTY: false` setup.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JsVwcBQP6VUwqEej3vK2zG1 parent 789ff74 commit 776d8d7
2 files changed
Lines changed: 48 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
116 | 132 | | |
117 | 133 | | |
118 | 134 | | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
382 | 399 | | |
383 | 400 | | |
384 | 401 | | |
385 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
386 | 407 | | |
387 | 408 | | |
388 | 409 | | |
389 | 410 | | |
390 | 411 | | |
391 | | - | |
| 412 | + | |
392 | 413 | | |
393 | 414 | | |
394 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
141 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
| |||
154 | 167 | | |
155 | 168 | | |
156 | 169 | | |
157 | | - | |
| 170 | + | |
| 171 | + | |
158 | 172 | | |
159 | 173 | | |
160 | 174 | | |
| |||
0 commit comments