diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 22b6b574d..e8f295040 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -88,7 +88,6 @@ public class ExcelUtil public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; - /** * Excel sheet最大行数,默认65536 */ 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 43163721d..34d07004e 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 @@ -1,5 +1,6 @@ package com.ruoyi.common.xss; +import com.ruoyi.common.utils.StringUtils; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import java.util.regex.Matcher; @@ -12,15 +13,19 @@ import java.util.regex.Pattern; */ public class XssValidator implements ConstraintValidator { - private final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; + private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; @Override public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { + if (StringUtils.isBlank(value)) + { + return true; + } return !containsHtml(value); } - public boolean containsHtml(String value) + public static boolean containsHtml(String value) { Pattern pattern = Pattern.compile(HTML_PATTERN); Matcher matcher = pattern.matcher(value);