| … | … | @@ -380,8 +380,66 @@ function markdownLinkDestinationScanner(markdown: string) { | |
| 386 | + | ||
| 387 | + | // `](C:\Users\Jo Doe\shot.png)` or with a title. Parentheses inside the path must balance. | |
| 388 | + | const SPACED_DRIVE_DESTINATION = | |
| 389 | + | /\]\([ \t]*([A-Za-z]:[\\/](?:[^()\n]|\([^()\n]*\))*?)(?=(?:[ \t]+"[^"\n]*")?[ \t]*\))/g; | |
🟠 High src/markdownLinks.ts:389
extractMarkdownLinkHrefs returns C:/work/file.ts 'Title' for a link with a single-quoted title, so callers try to resolve a nonexistent path. SPACED_DRIVE_DESTINATION recognizes only double-quoted titles and therefore protects the space before 'Title' as part of the destination; recognize single-quoted titles as well.
| 1 | /\]\([ \t]*([A-Za-z]:[\\/](?:[^()\n]|\([^()\n]*\))*?)(?=(?:[ \t]+(?:"[^"\n]*"|'[^'\n]*'))?[ \t]*\))/g; |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/shared/src/markdownLinks.ts around line 389: |
| 2 | |
| 3 | `extractMarkdownLinkHrefs` returns `C:/work/file.ts 'Title'` for a link with a single-quoted title, so callers try to resolve a nonexistent path. `SPACED_DRIVE_DESTINATION` recognizes only double-quoted titles and therefore protects the space before `'Title'` as part of the destination; recognize single-quoted titles as well. |
| … | … | @@ -380,8 +380,66 @@ function markdownLinkDestinationScanner(markdown: string) { | |
| 387 | + | // `](C:\Users\Jo Doe\shot.png)` or with a title. Parentheses inside the path must balance. | |
| 388 | + | const SPACED_DRIVE_DESTINATION = | |
| 389 | + | /\]\([ \t]*([A-Za-z]:[\\/](?:[^()\n]|\([^()\n]*\))*?)(?=(?:[ \t]+"[^"\n]*")?[ \t]*\))/g; | |
| 390 | + | const HAS_SPACED_DRIVE_DESTINATION = /\]\([ \t]*[A-Za-z]:[\\/][^)\n]* [^)\n]*\)/; | |
🟠 High src/markdownLinks.ts:390
/Jo Doe/shot.png) is returned without protecting its spaces, so the Windows image link still fails to render. The fast-path regex stops at the ) in work(backup) even though SPACED_DRIVE_DESTINATION handles balanced parentheses; let the preliminary check scan across parentheses too.
| 1 | const HAS_SPACED_DRIVE_DESTINATION = /\]\([ \t]*[A-Za-z]:[\\/][^\n]* [^\n]*\)/; |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/shared/src/markdownLinks.ts around line 390: |
| 2 | |
| 3 | `/Jo Doe/shot.png)` is returned without protecting its spaces, so the Windows image link still fails to render. The fast-path regex stops at the `)` in `work(backup)` even though `SPACED_DRIVE_DESTINATION` handles balanced parentheses; let the preliminary check scan across parentheses too. |