Skip to content

Commit

Permalink
Only escaped when shouldRenderHTML is true
Browse files Browse the repository at this point in the history
  • Loading branch information
kursat committed Sep 11, 2023
1 parent 40b3b29 commit bf0fbf9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/ArchivedReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Banner
containerStyles={[styles.archivedReportFooter]}
text={props.translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${_.escape(displayName)}</strong>`,
oldDisplayName: `<strong>${_.escape(oldDisplayName)}</strong>`,
policyName: `<strong>${_.escape(ReportUtils.getPolicyName(props.report))}</strong>`,
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
policyName: `<strong>${policyName}</strong>`,
})}
shouldRenderHTML={archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT}
shouldRenderHTML={shouldRenderHTML}
shouldShowIcon
/>
);
Expand Down

0 comments on commit bf0fbf9

Please sign in to comment.