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 2025-08-05] [Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with CMD + v #63711
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Version Number: v9.1.60-3 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@carlosmiceli Slack conversation (hyperlinked to channel name): #expensify_quality
Please re-state the problem that we are trying to solve in this issue.
Unable to paste text with CMD + v in compose box.
What is the root cause of that problem?
When copying HTML content and pasting it into the Composer component, the pastedHTML will be truncated with a limit of maxLength = CONST.MAX_COMMENT_LENGTH + 1 (where CONST.MAX_COMMENT_LENGTH = 10000).
What changes do you think we should make in order to solve the problem?
1. Approach 1:
The long HTML text results from having a large number of style attributes, which are very lengthy.
The htmlToMarkdown function does not process these style attributes, causing them to remain in the input text and leading to performance issues during parsing.
Alternatively, we can pre-process the HTML text before passing it to the main processing function. This ensures that the maxLength is still enforced and that only the necessary HTML text is passed to the parser. For example:
changed the title [-]Text input field - Unable to paste text with `CMD + v`[/-][+][$250] Text input field - Unable to paste text with `CMD + v`[/+]on Jun 9, 2025
let result = str_1.default.htmlDecode(this.replaceBlockElementWithNewLine(generatedMarkdown));
if (maxBodyLength > 0) {
/*
* Some HTML sources (such as Microsoft Word) have headers larger than the typical maxLength of
* 10K even for a small body text. So the text is truncated after extracting the body element, to
* maximise the amount of body text that is included while still staying inside the length limit.
*/
result = result.slice(0, maxBodyLength);
}
return result;
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
We can prevent to paste too long content (i.e. 20k characters)
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.
@justinpersaud@garrettmknight@jjcoffee / @nkdengineer The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
changed the title [-][Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-][+][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+]on Jul 28, 2025
changed the title [-][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-][+][Due for payment 2025-08-05] [Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+]on Jul 29, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.86-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@jjcoffee@garrettmknight The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[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: N/A
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Activity
melvin-bot commentedon Jun 6, 2025
Triggered auto assignment to @garrettmknight (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.dmkt9 commentedon Jun 7, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unable to paste text with
CMD + vin compose box.What is the root cause of that problem?
Composercomponent, thepastedHTMLwill be truncated with a limit ofmaxLength = CONST.MAX_COMMENT_LENGTH + 1(whereCONST.MAX_COMMENT_LENGTH = 10000).App/src/hooks/useHtmlPaste/index.ts
Line 40 in aeffce7
App/src/hooks/useHtmlPaste/index.ts
Line 158 in aeffce7
https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1245
https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1237-L1244
What changes do you think we should make in order to solve the problem?
1. Approach 1:
styleattributes, which are very lengthy.htmlToMarkdownfunction does not process thesestyleattributes, causing them to remain in the input text and leading to performance issues during parsing.Solution:
We can add a regex to remove the
styleattribute or any other unnecessary attributes at the beginning ofhtmlToMarkdownRules, while also removing themaxLengthlimit.https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L565
Alternatively, we can pre-process the HTML text before passing it to the main processing function. This ensures that the
maxLengthis still enforced and that only the necessary HTML text is passed to the parser.For example:
App/src/hooks/useHtmlPaste/index.ts
Line 158 in aeffce7
2. Approach 2:
Change
maxLengthaccordingly.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
N/A
bandicam.2025-06-07.18-08-19-832.mp4
[-]Text input field - Unable to paste text with `CMD + v`[/-][+][$250] Text input field - Unable to paste text with `CMD + v`[/+]melvin-bot commentedon Jun 9, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021932087512760984775
melvin-bot commentedon Jun 9, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (
External)nkdengineer commentedon Jun 9, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unable to paste text with CMD + v in compose box.
What is the root cause of that problem?
For the too long content, we will truncate it in
https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1236-L1247
and the
generatedMarkdownnow can't be decoded inhttps://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1259
because it doesn't contain enough content to decode, so we can't see anything
What changes do you think we should make in order to solve the problem?
We should truncate the content only after decode
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
We can prevent to paste too long content (i.e. 20k characters)
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.
98 remaining items
melvin-bot commentedon Jul 21, 2025
@justinpersaud @garrettmknight @jjcoffee / @nkdengineer The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
garrettmknight commentedon Jul 28, 2025
@jjcoffee please complete the checklist.
garrettmknight commentedon Jul 28, 2025
Payment summary:
[-][Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-][+][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+]nkdengineer commentedon Jul 28, 2025
@garrettmknight I think you mentioned the wrong contributor
[-][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-][+][Due for payment 2025-08-05] [Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+]melvin-bot commentedon Jul 29, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.86-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-08-05. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 29, 2025
@jjcoffee @garrettmknight The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
jjcoffee commentedon Aug 1, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/expensify-common/pull/852/files#r2247302924
[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: N/A
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Test:
Do we agree 👍 or 👎
trjExpensify commentedon Aug 1, 2025
Approved $250 for @jjcoffee