Repository navigation
Keep a file link plain when its text is the file's name as printed - #1553
Merged
Merged
Conversation
classifyDisplayMatch compared a file: link's path only against the normalized display text. Normalizing strips leading punctuation and composes decomposed characters, so ls --hyperlink output for _app.tsx, @types.d.ts, or a macOS NFD name no longer matched its own path, read as a dotted host name, and was classified deceptive, leaving the dialog with no open action. Match the path against the text as printed as well.
Deploying mouseterm with
|
| Latest commit: |
404d6dc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eb549e97.mouseterm.pages.dev |
| Branch Preview URL: | https://nightly-file-link-own-name.mouseterm.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #1534, a
file:hyperlink whose text is the file's own name gets the deceptive verdict when the name starts with punctuation (_app.tsx,@types.d.ts,-v1.md,#notes.md) or is stored decomposed (a macOS NFDcafé.md). The deceptive verdict leaves the link dialog with no Open action, and the host also rejects that verdict if its callback runs. This PR matches the link's path against the display text as printed, not only the normalized text, so those links are plain again.docs/specs/mouse-and-clipboard.md-> "OSC 8 hyperlinks" already says afile:target's own file name is not a host claim.Cause.
classifyDisplayMatchnormalizes the text before comparing it with the path: NFKC, with leading punctuation and symbols removed._app.tsxbecomesapp.tsxand no longer matches/repo/_app.tsx. #1534 also widenedBARE_DOMAIN_REto Unicode labels, so the normalized text now reads as a dotted host. That host differs from thefile:URI's empty host, so the verdict is deceptive.Where users hit it.
activateTerminalLink(lib/src/lib/terminal-link-activation.ts) sends a link torequestExternalLinkConfirmation, which classifies it. That happens for every link on a host withouttoolControl, which includes Pocket'sRemotePtyAdapter, sols --hyperlinkoutput on the phone hits it. On desktop it happens when thedor openpreview fails and the link falls back to the dialog.Tests. The new
external-links.test.tscases fail before the change and pass after it. They cover the four punctuation-led names, the NFD name, and the NFD name with a line suffix. Spoofing behavior does not change: text that matched the path after normalization still does, andgithub.com:443overfile:///repo/notes.txtis still deceptive.external-links,terminal-link-activation, andExternalLinkModalHosttests pass locally.