mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix check for void tags
This commit is contained in:
1 parent
562df8df6e
commit
66c5c6b560
2 files changed
+3
-2
No files matched your search
@@ -1,12 +1,13 @@
|
|||||||
import * as Xss from 'xss';
|
import * as Xss from 'xss';
|
||||||
|
|
||||||
const stack = [];
|
const stack = [];
|
||||||
|
const voidTags = ['br', 'hr', 'input', 'img', 'link', 'source', 'col', 'area', 'base', 'meta', 'embed', 'param', 'track', 'wbr'];
|
||||||
|
|
||||||
const tagCheck = new Xss.FilterXSS({
|
const tagCheck = new Xss.FilterXSS({
|
||||||
css: false,
|
css: false,
|
||||||
whiteList: {},
|
whiteList: {},
|
||||||
onIgnoreTag(tag, html, options) {
|
onIgnoreTag(tag, html, options) {
|
||||||
if (html.endsWith('/>')) return html;
|
if (html.endsWith('/>') || voidTags.includes(tag)) return html;
|
||||||
if (!options.isClosing) {
|
if (!options.isClosing) {
|
||||||
stack.push(tag);
|
stack.push(tag);
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.31.12",
|
"version": "4.31.13",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user