Skip to content

Commit 1148ef8

Browse files
wslve-lishenglan.wang
andauthored
fix:escapeHtml取消/匹配 (baidu#15561)
* fix:escapeHtml取消/匹配 * fix:/映射删除,测试用例修改 --------- Co-authored-by: shenglan.wang <[email protected]>
1 parent cef0025 commit 1148ef8

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

packages/amis-core/__tests__/async-filter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test(`filter:complex`, async () => {
3636
a: '<br />'
3737
}
3838
})
39-
).toEqual('&lt;br &#x2F;&gt;');
39+
).toEqual('&lt;br /&gt;');
4040
});
4141

4242
test(`filter:json`, async () => {

packages/amis-core/__tests__/filter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test(`filter:complex`, () => {
3636
a: '<br />'
3737
}
3838
})
39-
).toEqual('&lt;br &#x2F;&gt;');
39+
).toEqual('&lt;br /&gt;');
4040
});
4141

4242
test(`filter:json`, () => {

packages/amis-core/src/utils/escapeHtml.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const entityMap: {
55
'<': '&lt;',
66
'>': '&gt;',
77
'"': '&quot;',
8-
"'": '&#39;',
9-
'/': '&#x2F;'
8+
"'": '&#39;'
109
};
1110
export const escapeHtml = (str: string) =>
12-
String(str).replace(/[&<>"'\/]/g, function (s) {
11+
String(str).replace(/[&<>"']/g, function (s) {
1312
return entityMap[s];
1413
});

0 commit comments

Comments
 (0)