Browse Source

优化匹配方式

RuoYi 2 years ago
parent
commit
2dca6f0a12

+ 1 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/GenConstants.java

@@ -42,7 +42,7 @@ public class GenConstants
42
 
42
 
43
     /** 数据库数字类型 */
43
     /** 数据库数字类型 */
44
     public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
44
     public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
45
-            "bigint", "float", "double", "decimal" };
45
+            "bit", "bigint", "float", "double", "decimal" };
46
 
46
 
47
     /** 页面不需要编辑字段 */
47
     /** 页面不需要编辑字段 */
48
     public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
48
     public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };

+ 6 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/xss/XssValidator.java

@@ -27,8 +27,13 @@ public class XssValidator implements ConstraintValidator<Xss, String>
27
 
27
 
28
     public static boolean containsHtml(String value)
28
     public static boolean containsHtml(String value)
29
     {
29
     {
30
+        StringBuilder sHtml = new StringBuilder();
30
         Pattern pattern = Pattern.compile(HTML_PATTERN);
31
         Pattern pattern = Pattern.compile(HTML_PATTERN);
31
         Matcher matcher = pattern.matcher(value);
32
         Matcher matcher = pattern.matcher(value);
32
-        return matcher.matches();
33
+        while (matcher.find())
34
+        {
35
+            sHtml.append(matcher.group());
36
+        }
37
+        return pattern.matcher(sHtml).matches();
33
     }
38
     }
34
 }
39
 }