mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: fix safeAttrValue
This commit is contained in:
2 files changed
+6
-4
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { FilterXSS } from 'xss';
|
||||
import { FilterXSS, safeAttrValue } from 'xss';
|
||||
|
||||
const stack = [];
|
||||
const voidTags = ['br', 'hr', 'input', 'img', 'link', 'source', 'col', 'area', 'base', 'meta', 'embed', 'param', 'track', 'wbr'];
|
||||
@@ -111,9 +111,10 @@ export const xss = new FilterXSS({
|
||||
},
|
||||
allowCommentTag: false,
|
||||
stripIgnoreTagBody: ['script'],
|
||||
safeAttrValue(tag, name, value) { // eslint-disable-line consistent-return
|
||||
safeAttrValue(tag, name, value) {
|
||||
if (name === 'id') return `xss-id-${value}`;
|
||||
if (name === 'class') return value.replace(/badge/g, 'xss-badge');
|
||||
return safeAttrValue(tag, name, value, this.cssFilter);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -166,9 +167,10 @@ export const xssInline = new FilterXSS({
|
||||
allowCommentTag: false,
|
||||
stripIgnoreTag: true,
|
||||
stripIgnoreTagBody: ['script'],
|
||||
safeAttrValue(tag, name, value) { // eslint-disable-line consistent-return
|
||||
safeAttrValue(tag, name, value) {
|
||||
if (name === 'id') return `xss-id-${value}`;
|
||||
if (name === 'class') return value.replace(/badge/g, 'xss-badge');
|
||||
return safeAttrValue(tag, name, value, this.cssFilter);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.49.8",
|
||||
"version": "4.49.9",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
|
||||
Reference in new issue
Block a user