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
[HOLD for payment 2025-01-18] [$250] Web - Workspace - HTML characters are incorrectly shown as workspace name #54477
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.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:
Navigate to staging.new.expensify.com
Go to workspace settings - profile
Rename the workspace as "Hello"
Navigate to admin room
Note the updated workspace name
Go to workspace settings and delete the workspace
Navigate to admin room
Now note correct workspace name is shown
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.
changed the title [-]Web - HTML characters are incorrectly shown as workspace name[/-][+]Web - Workspace - HTML characters are incorrectly shown as workspace name[/+]on Dec 23, 2024
What changes do you think we should make in order to solve the problem?
We should use Str.safeEscape or Str.htmlEncode to convert the first before decoding it either in ReportActionItemBasicMessage or PureReportActionItem to target only actions named CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME.
// Either In ReportActionItemBasicMessage.tsx<Textstyle={[styles.chatItemMessage,styles.colorMuted]}>{Str.htmlDecode(Str.safeEscape(message))} // Or Str.htmlDecode(Str.htmlEncode(message))
</Text>// Or In PureReportActionItem.tsx children=<ReportActionItemBasicMessagemessage={Str.safeEscape(ReportUtils.getWorkspaceNameUpdatedMessage(action))}/>;
Test Screenshot
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 & character, and then, test if the rendered message in ReportActionItemBasicMessage is rendered as intended.
What alternative solutions did you explore? (Optional)
Create a prop called something like isText for the ReportActionItemBasicMessage component, then use it to create a condition to prevent message from being decoded as HTML.
Please re-state the problem that we are trying to solve in this issue.
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.
What is the root cause of that problem?
When we save a new policy name, we simply send the raw text to BE without encoding it, similar to how we handle updates to the description. In the case of updating the description, we encode the text::
For instance, when a user types hello for a policy name, it sends hello to BE. However, for a policy description, it sends the encoded form &#104;&#101;&#108;&#108;& to BE.
When displaying the policy change log message, we always decode the message:
Thus, hello will be decoded to hello. This is why we encounter this bug.
What changes do you think we should make in order to solve the problem?
We can address the issue by encoding the policy's name before sending it to the backend, similar to how we handle encoding when updating the policy's description. While this solution resolves the immediate issue, it requires extensive adjustments across various components to ensure the policy's name is consistently displayed. Alternatively, we can encode the source of the policy's name directly on the frontend, streamlining the process and reducing the number of dependent components. So
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We need to add to test for getWorkspaceNameUpdatedMessage function to make sure it always returns the encoded form of the message. Below are test cases in format input > output:
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.
For the system message issue, it's started to happen after #34081 where the MARKEDREIMBURSED message.text data also contains HTML entities which is also another BE issue since text should contain plain text, HTML should contain the HTML message.
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.
I watched the vid in the OP twice and still don't understand the bug. Added Needs Reproduction to see if a C+ can reproduce. If so... please provide screenshots (if only so that I have know what I'm missing). Thx
I watched the vid in the OP twice and still don't understand the bug. Added Needs Reproduction to see if a C+ can reproduce. If so... please provide screenshots (if only so that I have know what I'm missing). Thx
You can copy Hello as the new workspace name, and the workspace doesn't necessarily need to be archived.
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:
@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]
[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.
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 Dec 23, 2024
Triggered auto assignment to @mallenexpensify (
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.[-]Web - HTML characters are incorrectly shown as workspace name[/-][+]Web - Workspace - HTML characters are incorrectly shown as workspace name[/+]Tony-MK commentedon Dec 23, 2024
Proposal
Please 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
&character, which is interpreted as a hexadecimal in HTML.App/src/pages/home/report/PureReportActionItem.tsx
Lines 820 to 821 in 2458635
Passing the message without converting to
Str.htmlDecodewill convert the hexadecimal to its respective ASCII.App/src/pages/home/report/ReportActionItemBasicMessage.tsx
Line 16 in 2458635
What changes do you think we should make in order to solve the problem?
We should use
Str.safeEscapeorStr.htmlEncodeto convert the first before decoding it either inReportActionItemBasicMessageorPureReportActionItemto target only actions namedCONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME.Test Screenshot
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
&character, and then, test if the rendered message inReportActionItemBasicMessageis rendered as intended.What alternative solutions did you explore? (Optional)
Create a prop called something like
isTextfor theReportActionItemBasicMessagecomponent, then use it to create a condition to prevent message from being decoded as HTML.App/src/pages/home/report/ReportActionItemBasicMessage.tsx
Line 16 in 2458635
truph01 commentedon Dec 24, 2024
Proposal
Please 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
hellofor a policy name, it sendshelloto BE. However, for a policy description, it sends the encoded form&#104;&#101;&#108;&#108;&to BE.App/src/components/LHNOptionsList/OptionRowLHN.tsx
Line 303 in a088878
App/src/pages/home/report/ReportActionItemBasicMessage.tsx
Line 16 in 2458635
Thus,
hellowill be decoded tohello. This is why we encounter this bug.What changes do you think we should make in order to solve the problem?
App/src/libs/ReportUtils.ts
Line 4872 in a088878
will be:
App/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Line 415 in a088878
to get the correct copy message text.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
getWorkspaceNameUpdatedMessagefunction to make sure it always returns the encoded form of the message. Below are test cases in format input > output:hello>hello.hello>&#104;&#101;&#108;&#108;&.&#104;&#101;&#108;&#108;&>&#104;&#101;&#108;&#108;&What alternative solutions did you explore? (Optional)
App/src/libs/SidebarUtils.ts
Line 475 in a088878
and
App/src/pages/home/report/PureReportActionItem.tsx
Line 821 in a088878
bernhardoj commentedon Dec 24, 2024
Proposal
Please 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
ReportActionItemBasicMessage. In the component, we always decode the text.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.
App/src/components/LHNOptionsList/OptionRowLHN.tsx
Line 303 in 8b7096f
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 (
<p>test</p>), then the LHN last message will only showtest.For the system message issue, it's started to happen after #34081 where the MARKEDREIMBURSED
message.textdata also contains HTML entities which is also another BE issue since text should contain plain text, HTML should contain the HTML message.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.
App/src/components/LHNOptionsList/OptionRowLHN.tsx
Line 303 in 8b7096f
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
App/src/pages/home/report/ReportActionItemBasicMessage.tsx
Line 16 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.
melvin-bot commentedon Dec 27, 2024
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
MelvinBot commentedon Dec 30, 2024
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
mallenexpensify commentedon Dec 30, 2024
I watched the vid in the OP twice and still don't understand the bug. Added
Needs Reproductionto see if a C+ can reproduce. If so... please provide screenshots (if only so that I have know what I'm missing). ThxTony-MK commentedon Dec 30, 2024
You can copy
Hellۺs the new workspace name, and the workspace doesn't necessarily need to be archived.26 remaining items
melvin-bot commentedon Jan 11, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 11, 2025
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:
melvin-bot commentedon Jan 11, 2025
@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]
Add message text as fallback
suneox commentedon Jan 18, 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
[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.
N/A: It isn't an impactful bug
melvin-bot commentedon Jan 20, 2025
@carlosmiceli, @suneox, @mallenexpensify, @truph01 Whoops! This issue is 2 days overdue. Let's get this updated quick!
mallenexpensify commentedon Jan 21, 2025
Contributor: @truph01 paid $250 via Upwork
Contributor+: @suneox paid $250 via Upwork
I created a test case, to err on the safe side.
Thx