Skip to content

Commit

Permalink
Replace RIGHT-TO-LEFT OVERRIDE unicode (#2828)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
  • Loading branch information
dvaldivia authored May 23, 2023
1 parent 920fc7d commit 17e791a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions portal-ui/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,3 +712,9 @@ export const getRandomString = function (length = 16): string {
}
return retval;
};

// replaces bad unicode characters
export const replaceUnicodeChar = (inputString: string): string => {
let unicodeChar = "\u202E";
return inputString.split(unicodeChar).join("<�202e>");
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { Theme } from "@mui/material/styles";
import { replaceUnicodeChar } from "../../../../../../common/utils";

interface IIconWithLabel {
classes: any;
Expand Down Expand Up @@ -34,7 +35,7 @@ const IconWithLabel = ({ classes, icon, strings }: IIconWithLabel) => {
<div className={classes.fileName}>
{icon}
<span className={classes.fileNameText}>
{strings[strings.length - 1]}
{replaceUnicodeChar(strings[strings.length - 1])}
</span>
</div>
);
Expand Down

0 comments on commit 17e791a

Please sign in to comment.