Commit dbd7a2a
committed
Bugfix: error dialogs render OS strings verbatim
- Raw OS messages like `STATUS_DELETE_PENDING during Create` used to render in error dialogs as `STATUS<em>DELETE</em>PENDING` because `format!()` baked the underscores straight into snarkdown's input.
- New `Markdown` newtype + `md!` macro in `friendly_error/markdown.rs`: templates are trusted markdown; positional `{}` args go through the `MarkdownArg` trait which escapes plain strings, paths, and numbers, and passes `Markdown` values through unescaped.
- HTML-entity escape strategy (`_` etc.), not CommonMark `\_`. snarkdown doesn't honor backslash escapes — `\_` would render literally — so we encode and let the browser decode at `{@html}` time.
- `FriendlyError.{explanation,suggestion}` re-typed `String -> Markdown`; `#[serde(transparent)]` keeps the wire format unchanged.
- FE: bindings.ts post-processed in the regen test to emit `Markdown = string & { readonly __markdown: unique symbol }`. The sole `renderErrorMarkdown` call now rejects plain strings at compile time.
- ~30 call sites migrated across `friendly_error/`, `provider.rs`, `git/friendly.rs`. Captured-identifier `{name}` syntax replaced with positional `{}` (the macro can't escape captured idents).
- Conservative escape set: `.`, `-`, `+`, `#`, `|` left alone so paths and provider names like `Sync.com` render naturally.
- Regression test `io_serious_escapes_message_markdown_specials` pins the bug from the screenshot.1 parent 0ae2ee9 commit dbd7a2a
19 files changed
Lines changed: 808 additions & 453 deletions
File tree
- apps/desktop
- src-tauri/src
- file_system
- git
- volume
- friendly_error
- src/lib
- file-explorer
- pane
- file-operations/transfer
- ipc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
354 | | - | |
355 | | - | |
| 356 | + | |
| 357 | + | |
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
| |||
362 | 366 | | |
363 | 367 | | |
364 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
365 | 372 | | |
366 | 373 | | |
367 | 374 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
0 commit comments