-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD for payment 2025-01-18] [$250] Web - Workspace - HTML characters are incorrectly shown as workspace name #54477
Comments
Triggered auto assignment to @mallenexpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Web - Workspace - HTML characters are incorrectly shown as workspace name What is the root cause of that problem?The message has the App/src/pages/home/report/PureReportActionItem.tsx Lines 820 to 821 in 2458635
Passing the message without converting to
What changes do you think we should make in order to solve the problem?We should use // Either In ReportActionItemBasicMessage.tsx
<Text style={[styles.chatItemMessage, styles.colorMuted]}>
{Str.htmlDecode(Str.safeEscape(message))} // Or Str.htmlDecode(Str.htmlEncode(message))
</Text>
// Or In PureReportActionItem.tsx
children = <ReportActionItemBasicMessage message={
Str.safeEscape(ReportUtils.getWorkspaceNameUpdatedMessage(action))
} />; What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?We can create random actions with symbols that HTML decodes, such as the What alternative solutions did you explore? (Optional)Create a prop called something like
|
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
App/src/libs/actions/Policy/Policy.ts Line 1344 in a088878
For instance, when a user types
Thus, What changes do you think we should make in order to solve the problem?
Line 4872 in a088878
will be:
to get the correct copy message text. What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
Line 475 in a088878
and
|
ProposalPlease re-state the problem that we are trying to solve in this issue.The workspace name is decoded in the system message and LHN last message. What is the root cause of that problem?The system message is rendered with App/src/pages/home/report/ReportActionItemBasicMessage.tsx Lines 12 to 20 in 8b7096f
On the LHN, it's also the same. We previously had this issue which is caused because we also always convert the HTML to text.
The main issue here is that we ALWAYS decode the text. Copying from my proposal from #43563, the LHN issue started to happen after #40845 is merged. In that PR, we are converting HTML to text, so the HTML code is removed but you can still see the text inside the HTML tag. It's to solve this #40348 and #41141 where the last message text of the chat contains an HTML tag. It was a BE issue because the last message text shouldn't include any HTML tag. The one that includes the HTML tag is the last message HTML. That caused another issue where if we sent a plain text of HTML tag ( For the system message issue, it's started to happen after #34081 where the MARKEDREIMBURSED What changes do you think we should make in order to solve the problem?For the LHN solution, I suggest applying the same solution from #43563, that is to remove the conversion here because the BE issue that this code is trying to solve isn't happening anymore. If the QA found a similar issue on a different case, then it should be fixed on the BE, not patching it on the FE.
For the system message, it's also a BE issue and since we are not showing MARKEDREIMBURSED message anymore, so I suggest removing the conversion too. App/src/libs/ReportActionsUtils.ts Lines 665 to 669 in 8b7096f
(if we really need to do the conversion/decoding, then we need to apply it case by case, not to all cases) What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?If we decide to remove the FE patch, I'm not sure if a test is necessary here since we just show the text as it's without doing any modification. |
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989 |
I watched the vid in the OP twice and still don't understand the bug. Added |
You can copy |
Job added to Upwork: https://www.upwork.com/jobs/~021873881354318386175 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox ( |
Thanks @Tony-MK, I was able to reproduce. Added ![]() |
The issue you're encountering, where editing a name field in your app results in the text being converted to hexadecimal codes (like Hello), is almost certainly due to HTML entity encoding happening somewhere in your code. Here's a breakdown of the problem and the most likely causes: HTML Entity Encoding: This is a process of converting certain characters that have special meaning in HTML (like <, >, &, ", ') into their corresponding "entities." This prevents them from being interpreted as HTML markup. For example: < becomes <
Where the Encoding Might Be Happening: Server-Side Encoding: If you're sending the data to a server and then retrieving it, the server-side code (e.g., in Node.js, Python, PHP, etc.) might be encoding the data before sending it back to the client. This is a common security practice to prevent Cross-Site Scripting (XSS) vulnerabilities. Incorrectly Using dangerouslySetInnerHTML: If you're using dangerouslySetInnerHTML in your React code, and the content you're setting contains HTML entities, React won't automatically decode them. This is because dangerouslySetInnerHTML bypasses React's normal rendering process and directly sets the HTML content. Only use this if you have absolute trust in the source of the HTML. A Library or Utility Function: You might be using a third-party library or a utility function in your code that's performing the encoding. Accidental Double Encoding: It's also possible that the data is being encoded twice, compounding the issue. |
📣 @Salmansulehry! 📣
|
Thanks for all proposals. Currently, this issue only occurs when we decode the updated ws name change log displayed on 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @carlosmiceli, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @suneox 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @truph01 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@Tony-MK In my comment, I've pointed out that this issue only occurs when we decode the updated WS name change log, and the RCA, solution from selected proposal is different from yours.
|
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.83-5 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-01-18. 🎊 For reference, here are some details about the assignees on this issue:
|
@suneox @mallenexpensify @suneox 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] |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
|
@carlosmiceli, @suneox, @mallenexpensify, @truph01 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.77-6
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
Code based characters name must be updated as workspace name in admins room.
Actual Result:
Inconsistency in workspace display name. Instead of html code based character name, "hello" is displayed when workspace name is altered. Hello is incorrectly shown as workspace name in admins room when workspace is renamed.
Workaround:
Unknown
Platforms:
Screenshots/Videos
bug.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @mallenexpensifyThe text was updated successfully, but these errors were encountered: