From 85170547428cafea10837c48d2c7d18dd23fa67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BCr=C5=9Fat=20Yi=C4=9Fito=C4=9Flu?= Date: Sat, 9 Sep 2023 19:06:48 +0300 Subject: [PATCH 1/3] Web -Workspace - Inconsistency in Workspace Notification for HTML Character-Based Workspace Names #24427 --- src/components/ArchivedReportFooter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js index 70741f352089..5387950fac20 100644 --- a/src/components/ArchivedReportFooter.js +++ b/src/components/ArchivedReportFooter.js @@ -2,6 +2,7 @@ import lodashGet from 'lodash/get'; import React from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; +import _ from "lodash"; import CONST from '../CONST'; import Banner from './Banner'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; @@ -64,9 +65,9 @@ function ArchivedReportFooter(props) { ${displayName}`, - oldDisplayName: `${oldDisplayName}`, - policyName: `${ReportUtils.getPolicyName(props.report)}`, + displayName: `${_.escape(displayName)}`, + oldDisplayName: `${_.escape(oldDisplayName)}`, + policyName: `${_.escape(ReportUtils.getPolicyName(props.report))}`, })} shouldRenderHTML={archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT} shouldShowIcon From fb8636ebd4828233f3c022ddb6214eab3e72d3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BCr=C5=9Fat=20Yi=C4=9Fito=C4=9Flu?= Date: Sat, 9 Sep 2023 20:13:09 +0300 Subject: [PATCH 2/3] Fixed prettier diff --- src/components/ArchivedReportFooter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js index 5387950fac20..6e54b33fdbf3 100644 --- a/src/components/ArchivedReportFooter.js +++ b/src/components/ArchivedReportFooter.js @@ -2,7 +2,7 @@ import lodashGet from 'lodash/get'; import React from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; -import _ from "lodash"; +import _ from 'lodash'; import CONST from '../CONST'; import Banner from './Banner'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; From bf0fbf9739dbe2fb410869c0bca70501bb523a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BCr=C5=9Fat=20Yi=C4=9Fito=C4=9Flu?= Date: Mon, 11 Sep 2023 17:50:22 +0300 Subject: [PATCH 3/3] Only escaped when shouldRenderHTML is true --- src/components/ArchivedReportFooter.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js index 6e54b33fdbf3..71d331b68db0 100644 --- a/src/components/ArchivedReportFooter.js +++ b/src/components/ArchivedReportFooter.js @@ -61,15 +61,25 @@ function ArchivedReportFooter(props) { oldDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetails, [oldAccountID, 'displayName']); } + const shouldRenderHTML = archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT; + + let policyName = ReportUtils.getPolicyName(props.report); + + if (shouldRenderHTML) { + oldDisplayName = _.escape(oldDisplayName); + displayName = _.escape(displayName); + policyName = _.escape(policyName); + } + return ( ${_.escape(displayName)}`, - oldDisplayName: `${_.escape(oldDisplayName)}`, - policyName: `${_.escape(ReportUtils.getPolicyName(props.report))}`, + displayName: `${displayName}`, + oldDisplayName: `${oldDisplayName}`, + policyName: `${policyName}`, })} - shouldRenderHTML={archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT} + shouldRenderHTML={shouldRenderHTML} shouldShowIcon /> );