You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-08-17] [$250] When a system message contains a URL, the link is displayed as raw Markdown instead of being rendered as a clickable hyperlink. #96687
Version Number: v9.4.41-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@JmillsExpensify Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Create an expense report.
Add a description containing a URL/link.
Update the description with a different URL/link.
Observe the system message generated after the description change.
Expected Result:
The URL in the system message should be rendered as a clickable hyperlink.
The updated description link should display correctly without exposing raw Markdown formatting.
Actual Result:
The URL appears as Markdown text instead of a clickable hyperlink in the system message.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
When a user updates an expense report description from one URL to another, NewDot builds a system message like "changed the description to ...". The new and old descriptions are wrapped into Markdown links so they render as clickable text, and the link label is passed through escapeLinkText in MarkdownLinkHelpers.ts:
escapeLinkText replaces every [ and ] with the HTML entities [ and ]. When the description itself is a Markdown link such as [label](https://example.com), the surrounding brackets get escaped, so the resulting string is no longer valid Markdown link syntax. The renderer then prints the raw entity-escaped Markdown (the [...](...) text) instead of producing a clickable hyperlink, which is exactly what the screenshots show.
Because the escaping is applied unconditionally to the whole description, a description that is (or contains) a URL/Markdown link is corrupted before it reaches the Markdown parser, so the link never renders.
What changes do you think we should make in order to solve the problem?
In MarkdownLinkHelpers.ts, escapeLinkText currently escapes brackets even when the incoming text is already a valid URL or Markdown link. Detect that case and preserve the link so the parser can render it:
constescapeLinkText=(text: string): string=>{if(!text){return'';}constcollapsed=text.replaceAll(/\r?\n+/g,' ').replaceAll(/\s+/g,' ').trim();// If the value is already a URL or a Markdown link, leave brackets intact so it renders as a hyperlinkif(Str.isValidURL(collapsed)||CONST.REGEX.MARKDOWN_LINK?.test(collapsed)){returncollapsed;}returncollapsed.replaceAll('[','[').replaceAll(']',']');};
Confirm the callers that build the description-change system message use this helper only for plain label text, not for content that is itself a URL. When the new/old description is a bare URL, the message should render it directly as a link rather than double-wrapping it in Markdown that then gets escaped.
This keeps the whitespace collapsing behavior intact for normal labels while ensuring URL/Markdown-link descriptions survive escaping and render as clickable hyperlinks in the system message.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
When an expense description containing a URL is added or updated, the resulting system message ("changed the description to …") shows the link as raw Markdown ([text](url)) / plain text instead of a clickable hyperlink.
What is the root cause of that problem?
The structural cause: getForReportAction builds an HTML message, but the description fragment is the one field that injects Markdown into it. The HTML renderer does not parse Markdown, so the Markdown source shows literally.
The verified chain:
Descriptions are stored as HTML: updateMoneyRequestDescription parses the typed text with getParsedComment (ExpensiMark → HTML), so a URL becomes <a href="…">…</a>:
The message is rendered as HTML, not Markdown: ModifiedExpenseContent → ReportActionItemMessageWithExplain feeds it straight into RenderHTML, which shows the Markdown characters verbatim — the reported symptom:
The HTML contract is explicit in the same message: the MCC category fragment and the appended Explain link are raw <a> tags that render correctly today —
. The description fragment is the only Markdown producer.
This is a leftover, not intent: the conversion came from PR #44523, when this message was rendered as plain text and showing Markdown source was correct. The pipeline has since moved to HTML, and every consumer now treats the return value as HTML, so the stale conversion breaks all of them:
Chat system message (main repro): RenderHTML (link above).
LHN last-message preview: htmlToText leaves the Markdown visible —
This explains every symptom detail: raw Markdown visible, link not clickable, all platforms (shared code path), and only the description field affected (other fields are plain scalar values).
What changes do you think we should make in order to solve the problem?
Stop converting the stored HTML to Markdown — pass it through, matching the function's HTML contract. In src/libs/ModifiedExpenseMessage.ts (both call sites):
// getForReportAction, description fragment (~L360):buildMessageFragmentForValue(translate,reportActionOriginalMessage?.newComment??'',reportActionOriginalMessage?.oldComment??'',
...
// getRulesModifiedMessage (~L250):returntranslate('iou.rulesModifiedFields.common','description',updatedValue,isFirst);
Every surface then inherits correctness from its existing per-surface conversion: RenderHTML renders a real clickable <a> in chat; htmlToText/getTextFromHtml yield clean plain text for LHN/previews/notifications; clipboard does exactly one htmlToMarkdown pass. The fix removes a conversion instead of adding one. I'd add a URL case to tests/unit/ModifiedExpenseMessageTest.ts.
Regression safety in one sentence: all five consumers already treat the return value as HTML (their variables are literally named …WithHTML) and sibling fragments already embed <a> tags, so no consumer reads the description fragment as Markdown and non-description fields are untouched.
Why the obvious spot fix fails: converting the final message with Parser.replace(...) at the render sink does not work — ExpensiMark's replace() HTML-escapes its input, so the legitimate <a> tags already inside the same string (the MCC "workspace rules" link and the appended Explain link) would be escaped into visible literal tags; and it only fixes chat, leaving LHN previews, notifications, and clipboard still emitting raw/escaped Markdown because they never pass through that sink.
What alternative solutions did you explore? (Optional)
Parser.replace in ReportActionItemMessageWithExplain/ModifiedExpenseContent — the spot fix; incomplete and self-defeating as shown above.
Converting the description Markdown back to HTML after building fragments — a circular html → markdown → html round trip adding runtime work and lossy edge cases; passing the stored HTML through removes the conversion entirely.
The server-side ModifiedExpense::getNewDotComment mirror can be aligned in a follow-up; the App recomputes this message locally, so this in-repo change fully fixes the bug on its own.
Please re-state the problem that we are trying to solve in this issue.
When an expense's description contains a URL and the description is edited, the system message in the report ("changed the description to ... (previously ...)") displays the link as raw Markdown — for example [https://example.com](https://example.com) — instead of rendering it as a clickable hyperlink.
What is the root cause of that problem?
Expense descriptions are stored as HTML. When a description is saved, the text is run through the Markdown parser, so a bare URL becomes an HTML anchor. This is true both for the server-stored value and for the optimistic update, which parses the comment before writing it:
The system message for a modified expense is built client-side by getForReportAction in ModifiedExpenseMessage.ts. For the description field, it converts the stored old/new HTML values into Markdown using Parser.htmlToMarkdown:
However, the string this function returns is consumed as HTML everywhere. The chat message is injected directly into RenderHTML by ReportActionItemMessageWithExplain (used by ModifiedExpenseContent, the renderer for modified-expense actions):
RenderHTML renders HTML tags, but Markdown link syntax is not HTML, so the literal characters [text](url) are displayed as-is in the system message — exactly what the screenshots show.
Every other consumer of getForReportAction also treats the result as HTML: the LHN preview strips it with Parser.htmlToText, the browser notification strips it with getTextFromHtml, the report-name fallback strips it with Parser.htmlToText, and the context-menu copy converts it with Parser.htmlToMarkdown:
Because the description fragment is Markdown rather than HTML, those strip/convert calls are no-ops on it — which is why the raw [text](url) also leaks into the LHN last-message preview.
That the message pipeline is HTML-based is confirmed by sibling fragments in the same function: the category-change fragment already embeds an HTML anchor for the workspace-rules link (the "based on MCC" attribution) and it renders as a clickable link through this exact path.
What changes do you think we should make in order to solve the problem?
In getForReportAction in ModifiedExpenseMessage.ts, stop converting the description values to Markdown: pass reportActionOriginalMessage.newComment and reportActionOriginalMessage.oldComment to buildMessageFragmentForValue directly (removing the two Parser.htmlToMarkdown wrappers), so the description fragment carries the stored HTML.
With that single change, every consumer behaves correctly by construction:
The chat system message renders through RenderHTML, so the anchor becomes a clickable hyperlink, matching the expected result.
The LHN preview, browser notification, and report-name fallback strip the HTML tags and show clean plain text (this also fixes the raw-Markdown leak in the LHN preview).
Copying the message from the context menu still yields Markdown, since that path converts the HTML with Parser.htmlToMarkdown — unchanged behavior.
The same mismatch exists in the rules-modified branch of the same file (getRulesModifiedMessage, where the backend's comment field is likewise converted with Parser.htmlToMarkdown before display), and it should receive the identical one-line treatment for consistency:
Those are the only three uses of the Markdown parser in this file, so its import becomes unused and is removed as well.
Existing unit tests in ModifiedExpenseMessageTest.ts use plain-text descriptions, for which the conversion was a no-op, so they remain valid; a test asserting that an HTML description passes through unmodified can be added. Note the file's doc comment says the backend's ModifiedExpense::getNewDotComment mirrors this function — the backend's HTML message variant can be aligned the same way, but the display fix for New Expensify is entirely client-side since the app rebuilds this message locally from originalMessage.
What alternative solutions did you explore? (Optional)
Converting the finished message from Markdown to HTML at the render site (running the parser over it in ModifiedExpenseContent before handing it to RenderHTML). Rejected: the built message can already contain legitimate HTML (the MCC-based category attribution embeds an anchor), which re-parsing with text escaping would mangle, and it would fix only the chat rendering while leaving the raw-Markdown leak in the LHN preview and notifications, all of which expect HTML input from this function.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Couldn't pinpoint to the exact PR where we should've supported HTML for preview description.
Link to the comment on the Issue: NA
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Create an expense (e.g. Track/Submit an expense to yourself).
Set the description to a URL, e.g. https://old.example.com.
Edit the description again to a different URL, e.g. https://new.example.com.
Verify the resulting "changed the description to …" system message renders both the old and new descriptions as clickable hyperlinks, not raw [text](url) Markdown text.
Verify the LHN last-message preview and thread name show clean plain text (no visible Markdown syntax).
Activity
samranahm commentedon Jul 23, 2026
Proposal
What is the root cause of that problem?
When a user updates an expense report description from one URL to another, NewDot builds a system message like "changed the description to ...". The new and old descriptions are wrapped into Markdown links so they render as clickable text, and the link label is passed through
escapeLinkTextinMarkdownLinkHelpers.ts:App/src/libs/MarkdownLinkHelpers.ts
Lines 30 to 39 in 52a017e
escapeLinkTextreplaces every[and]with the HTML entities[and]. When the description itself is a Markdown link such as[label](https://example.com), the surrounding brackets get escaped, so the resulting string is no longer valid Markdown link syntax. The renderer then prints the raw entity-escaped Markdown (the[...](...)text) instead of producing a clickable hyperlink, which is exactly what the screenshots show.Because the escaping is applied unconditionally to the whole description, a description that is (or contains) a URL/Markdown link is corrupted before it reaches the Markdown parser, so the link never renders.
What changes do you think we should make in order to solve the problem?
MarkdownLinkHelpers.ts,escapeLinkTextcurrently escapes brackets even when the incoming text is already a valid URL or Markdown link. Detect that case and preserve the link so the parser can render it:App/src/libs/MarkdownLinkHelpers.ts
Lines 30 to 39 in 52a017e
This keeps the whitespace collapsing behavior intact for normal labels while ensuring URL/Markdown-link descriptions survive escaping and render as clickable hyperlinks in the system message.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
ahmdshrif commentedon Jul 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an expense description containing a URL is added or updated, the resulting system message ("changed the description to …") shows the link as raw Markdown (
[text](url)) / plain text instead of a clickable hyperlink.What is the root cause of that problem?
The structural cause:
getForReportActionbuilds an HTML message, but the description fragment is the one field that injects Markdown into it. The HTML renderer does not parse Markdown, so the Markdown source shows literally.The verified chain:
updateMoneyRequestDescriptionparses the typed text withgetParsedComment(ExpensiMark → HTML), so a URL becomes<a href="…">…</a>:App/src/libs/actions/IOU/UpdateMoneyRequest.ts
Lines 1207 to 1210 in 0169d32
originalMessage.newComment/oldComment:App/src/libs/ReportUtils.ts
Lines 6133 to 6138 in 0169d32
Parser.htmlToMarkdown, producing[text](url):App/src/libs/ModifiedExpenseMessage.ts
Lines 360 to 369 in 0169d32
ModifiedExpenseContent→ReportActionItemMessageWithExplainfeeds it straight intoRenderHTML, which shows the Markdown characters verbatim — the reported symptom:App/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx
Lines 85 to 92 in 0169d32
Explainlink are raw<a>tags that render correctly today —App/src/languages/en.ts
Line 1580 in 0169d32
App/src/languages/en.ts
Line 1817 in 0169d32
This is a leftover, not intent: the conversion came from PR
#44523, when this message was rendered as plain text and showing Markdown source was correct. The pipeline has since moved to HTML, and every consumer now treats the return value as HTML, so the stale conversion breaks all of them:RenderHTML(link above).htmlToTextleaves the Markdown visible —App/src/libs/OptionsListUtils/index.ts
Lines 801 to 813 in 0169d32
App/src/libs/ReportNameUtils.ts
Lines 918 to 929 in 0169d32
getTextFromHtml—App/src/libs/Notification/LocalNotification/BrowserNotifications.ts
Lines 165 to 176 in 0169d32
htmlToMarkdownon a string already containing Markdown, escaping it (\[url\]) —App/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Lines 969 to 980 in 0169d32
commentkey —App/src/libs/ModifiedExpenseMessage.ts
Lines 248 to 251 in 0169d32
This explains every symptom detail: raw Markdown visible, link not clickable, all platforms (shared code path), and only the description field affected (other fields are plain scalar values).
What changes do you think we should make in order to solve the problem?
Stop converting the stored HTML to Markdown — pass it through, matching the function's HTML contract. In
src/libs/ModifiedExpenseMessage.ts(both call sites):Every surface then inherits correctness from its existing per-surface conversion:
RenderHTMLrenders a real clickable<a>in chat;htmlToText/getTextFromHtmlyield clean plain text for LHN/previews/notifications; clipboard does exactly onehtmlToMarkdownpass. The fix removes a conversion instead of adding one. I'd add a URL case totests/unit/ModifiedExpenseMessageTest.ts.Regression safety in one sentence: all five consumers already treat the return value as HTML (their variables are literally named
…WithHTML) and sibling fragments already embed<a>tags, so no consumer reads the description fragment as Markdown and non-description fields are untouched.Why the obvious spot fix fails: converting the final message with
Parser.replace(...)at the render sink does not work — ExpensiMark'sreplace()HTML-escapes its input, so the legitimate<a>tags already inside the same string (the MCC "workspace rules" link and the appendedExplainlink) would be escaped into visible literal tags; and it only fixes chat, leaving LHN previews, notifications, and clipboard still emitting raw/escaped Markdown because they never pass through that sink.What alternative solutions did you explore? (Optional)
Parser.replaceinReportActionItemMessageWithExplain/ModifiedExpenseContent— the spot fix; incomplete and self-defeating as shown above.html → markdown → htmlround trip adding runtime work and lossy edge cases; passing the stored HTML through removes the conversion entirely.ModifiedExpense::getNewDotCommentmirror can be aligned in a follow-up; the App recomputes this message locally, so this in-repo change fully fixes the bug on its own.wildan-m commentedon Jul 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an expense's description contains a URL and the description is edited, the system message in the report ("changed the description to ... (previously ...)") displays the link as raw Markdown — for example
[https://example.com](https://example.com)— instead of rendering it as a clickable hyperlink.What is the root cause of that problem?
Expense descriptions are stored as HTML. When a description is saved, the text is run through the Markdown parser, so a bare URL becomes an HTML anchor. This is true both for the server-stored value and for the optimistic update, which parses the comment before writing it:
App/src/libs/actions/IOU/UpdateMoneyRequest.ts
Lines 1207 to 1210 in 53efbbd
The system message for a modified expense is built client-side by
getForReportActioninModifiedExpenseMessage.ts. For the description field, it converts the stored old/new HTML values into Markdown usingParser.htmlToMarkdown:App/src/libs/ModifiedExpenseMessage.ts
Lines 360 to 369 in 53efbbd
However, the string this function returns is consumed as HTML everywhere. The chat message is injected directly into
RenderHTMLbyReportActionItemMessageWithExplain(used byModifiedExpenseContent, the renderer for modified-expense actions):App/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx
Lines 87 to 91 in 53efbbd
RenderHTMLrenders HTML tags, but Markdown link syntax is not HTML, so the literal characters[text](url)are displayed as-is in the system message — exactly what the screenshots show.Every other consumer of
getForReportActionalso treats the result as HTML: the LHN preview strips it withParser.htmlToText, the browser notification strips it withgetTextFromHtml, the report-name fallback strips it withParser.htmlToText, and the context-menu copy converts it withParser.htmlToMarkdown:App/src/libs/OptionsListUtils/index.ts
Line 808 in 53efbbd
Because the description fragment is Markdown rather than HTML, those strip/convert calls are no-ops on it — which is why the raw
[text](url)also leaks into the LHN last-message preview.That the message pipeline is HTML-based is confirmed by sibling fragments in the same function: the category-change fragment already embeds an HTML anchor for the workspace-rules link (the "based on MCC" attribution) and it renders as a clickable link through this exact path.
What changes do you think we should make in order to solve the problem?
In
getForReportActioninModifiedExpenseMessage.ts, stop converting the description values to Markdown: passreportActionOriginalMessage.newCommentandreportActionOriginalMessage.oldCommenttobuildMessageFragmentForValuedirectly (removing the twoParser.htmlToMarkdownwrappers), so the description fragment carries the stored HTML.With that single change, every consumer behaves correctly by construction:
RenderHTML, so the anchor becomes a clickable hyperlink, matching the expected result.Parser.htmlToMarkdown— unchanged behavior.The same mismatch exists in the rules-modified branch of the same file (
getRulesModifiedMessage, where the backend'scommentfield is likewise converted withParser.htmlToMarkdownbefore display), and it should receive the identical one-line treatment for consistency:App/src/libs/ModifiedExpenseMessage.ts
Lines 248 to 251 in 53efbbd
Those are the only three uses of the Markdown parser in this file, so its import becomes unused and is removed as well.
Existing unit tests in
ModifiedExpenseMessageTest.tsuse plain-text descriptions, for which the conversion was a no-op, so they remain valid; a test asserting that an HTML description passes through unmodified can be added. Note the file's doc comment says the backend'sModifiedExpense::getNewDotCommentmirrors this function — the backend's HTML message variant can be aligned the same way, but the display fix for New Expensify is entirely client-side since the app rebuilds this message locally fromoriginalMessage.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/96687-description-link-html?expand=1
What alternative solutions did you explore? (Optional)
Converting the finished message from Markdown to HTML at the render site (running the parser over it in
ModifiedExpenseContentbefore handing it toRenderHTML). Rejected: the built message can already contain legitimate HTML (the MCC-based category attribution embeds an anchor), which re-parsing with text escaping would mangle, and it would fix only the chat rendering while leaving the raw-Markdown leak in the LHN preview and notifications, all of which expect HTML input from this function.melvin-bot commentedon Jul 23, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)52 remaining items
mananjadhav commentedon Aug 16, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Couldn't pinpoint to the exact PR where we should've supported HTML for preview description.
Link to the comment on the Issue: NA
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
https://old.example.com.https://new.example.com.[text](url)Markdown text.Do we agree 👍 or 👎
melvin-bot commentedon Aug 16, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 16, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 18, 2026
Payment Summary
Contributor: @ahmdshrif paid $250 via Upwork
Contributor+: @mananjadhav due $250 via NewDot
mananjadhav commentedon Aug 18, 2026
@mallenexpensify Can you correct the name for C+ here?
mallenexpensify commentedon Aug 18, 2026
@mananjadhav done. GH can suck sometimes
mananjadhav commentedon Aug 18, 2026
Yes I can relate 😬 Thanks for the quick action.
garrettmknight commentedon Aug 25, 2026
$250 approved for @mananjadhav