Repository navigation
fix(slack): keep a label's escaped closing bracket when shortening local paths - #52292
Conversation
…cal paths A remote-link or image label ending in a local path whose last backslash escaped the closing ] lost that escape, turning literal text into a live link. Redact labels as they sit before their ], reusing the bare-path escape rule, and pin the trailing-separator prose behavior.
[Low impact] The PR appears safe to merge; no actionable issues were found. SummaryPreserves a trailing backslash when shortening local paths inside kept Markdown link and image labels.
Reviews (1) · Last reviewed commit: "fix(slack): keep a label's escaped closi..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
When Orca shortens a local file path inside a Markdown link label before sharing to Slack, it could drop a backslash that was escaping the label's closing bracket. That turned text that was meant to be literal into a live link or image.
What Changed
[C:\Users\ada\proj\](https://e.test/x)became[proj](https://e.test/x), which is now a working link (andbecame a rendered remote image).[proj\](https://e.test/x), so the escape survives and the text stays literal.]followed them. That reuses the existing rule that keeps a trailing backslash when it escapes the next punctuation character. Links to local targets still collapse to plain words, unchanged.see C:\Users\ada\proj\) now→see proj\) now) and the label\*escape. Before this PR, no test covered either.Why
Redaction output must not change Markdown meaning. Reusing the existing bare-path escape rule keeps one consistent behavior instead of adding a second label-specific parser. Checked against how comparable products handle this.
Linked Issue
Maintainer follow-up; no issue.
Visual Proof
N/A: text-transformation logic with no UI change; covered by unit tests.
Testing
Escaping is a security boundary, so tests are committed. The 5 new label cases fail before the fix and pass after. The 2 pinned cases fail if the existing escape rule is reverted. Every case also checks that redacting the output again changes nothing. The targeted test file passes locally (77/77), and a Linux gate passed on a branch that contains this commit.
Performance
By code reasoning: one extra string copy per redacted label (label +
]), whose content is already scanned in full. No new I/O, index, or repeated scan, so total work stays linear in the input.Risk
Level: Low. The only output change is a kept trailing backslash in a bracketed label when it escapes
]. Every private path segment is still removed. Back out with a plain revert.Gaps: macOS and Windows are not separately verified (the logic is platform-independent string processing), and the local gate ran on a stacked branch containing this commit rather than this exact head; hosted CI covers the exact head.
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)