From 649cfe8652b3b25e553d1985a27da9aeec77daf4 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 25 Jan 2024 11:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/xss/XssValidator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java index 34d07004..b859428e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java @@ -27,8 +27,13 @@ public class XssValidator implements ConstraintValidator public static boolean containsHtml(String value) { + StringBuilder sHtml = new StringBuilder(); Pattern pattern = Pattern.compile(HTML_PATTERN); Matcher matcher = pattern.matcher(value); - return matcher.matches(); + while (matcher.find()) + { + sHtml.append(matcher.group()); + } + return pattern.matcher(sHtml).matches(); } } \ No newline at end of file