Repository navigation
fix: prevent partial links in URLs and emails with oversized hostnames - #966
Conversation
…ontext when linking Reject the full hostname when a label or the complete hostname exceeds its length limit. Previously, an earlier valid-looking domain could still become a partial link. Check URL matches against the original email text after masking an oversized domain. This keeps the email's local part from becoming a web link and the remainder from becoming a mention.
|
@AndrewGable Sorry for the review ping, this PR will be reviewed by @linhvovan29546 and @JS00001 Thanks. |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: mWeb Safari |
I'm unsure about codex review because codex review can't run in the PRs from fork, its an issue in codex in openai which is still open. |
|
The Codex review command is unavailable. It only works for |
|
@JS00001 Could you please review this PR? TY |




Explanation of Change
This PR follows up on the hostname length validation in expensify-common #951. Testing the App upgrade found two cases where an oversized hostname was rejected, but other parts of the same input were still formatted as links.
When a hostname contained an earlier valid-looking domain, such as
foo.com, ExpensiMark could link that shorter domain even though it was part of one oversized hostname. When an email address had an oversized domain, the URL check could lose sight of the@and link the part before it as a website.This change keeps the whole hostname plain when it exceeds either hostname length limit. It also checks URL matches against the original email text, so rejecting the domain does not turn the address into a web link or a mention. Separate valid URLs before or after these inputs still become links.
Fixed Issues
$ #102500
PROPOSAL:
Tests
Test 1: Oversized hostnames
Open the App and open any chat.
Paste the following URL into the composer and add a space:
Verify that the entire URL stays plain. In particular,
https://foo.commust not become a link on its own.Repeat with this long dotted URL and verify that it also stays completely plain:
Paste
https://foo.comseparately and verify that this valid URL becomes a link.Send each message and verify that it keeps the same formatting.
Test 2: Email with an oversized domain
Open any chat.
Paste the following text into the composer and add a space:
Verify that
valid.netandvalid.orgbecome links, while the entire email address stays plain.Send the message and verify that the same parts remain linked or plain.
Send
[email protected]separately and verify that a normal email address is still linked.Offline tests
Same as Test
QA Steps
Same as Test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android-native.1.mp4
Android: mWeb Chrome
Android-mweb.mp4
iOS: Native
iOS-native.mp4
iOS: mWeb Safari
iOS-safari.mp4
MacOS: Chrome / Safari
macOS.mp4