From 38c2939d658e752cb21517060db332aaa17e3185 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Tue, 13 Jun 2023 14:44:48 +0800 Subject: [PATCH] fix: fix the error message Fix the unreadable error messages with html characters. Closes-Bug: #2023627 Change-Id: I06d09327d1423578efafc8e51107acb4025e992b --- package.json | 1 + src/components/Notify/index.jsx | 5 ++++- yarn.lock | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c8f1597..bc8e912e 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "escape-html": "^1.0.3", "file-saver": "^2.0.2", "history": "4.7.2", + "html-entities": "^2.3.5", "intersection-observer": "^0.11.0", "intl-messageformat": "7.8.4", "invariant": "^2.2.4", diff --git a/src/components/Notify/index.jsx b/src/components/Notify/index.jsx index c2535038..3865c062 100644 --- a/src/components/Notify/index.jsx +++ b/src/components/Notify/index.jsx @@ -27,6 +27,7 @@ import globalRootStore from 'stores/root'; import { unescapeHtml } from 'utils/index'; import { statusMap } from 'src/utils/code'; import { isEmpty, isString } from 'lodash'; +import { decode } from 'html-entities'; import styles from './index.less'; const open = (args) => { @@ -140,6 +141,8 @@ const errorWithDetail = (err, title) => { nTitle += statusMap[status]; } } else { + const decodeErr = + err && isString(err) ? decode(err, { level: 'html5' }) : err; // prettier-ignore description = err ? { component={