Commit 48e10590 authored by sgjj's avatar sgjj

修复搜索空异常

parent aba427d3
...@@ -343,11 +343,11 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -343,11 +343,11 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
if (field != null) { if (field != null) {
for (Map.Entry<String, Object> entry : field.entrySet()) { for (Map.Entry<String, Object> entry : field.entrySet()) {
if (entry != null) { if (entry != null) {
String value = entry.getValue().toString().replaceAll("('|\"|\\\\)","\\\\$1"); // 处理由get方法请求中文乱码问题 if (ObjectUtil.isNull(entry.getValue())) {
value=clearXss(value);
if (ObjectUtil.isNull(value)) {
continue; continue;
} }
String value = entry.getValue().toString().replaceAll("('|\"|\\\\)","\\\\$1"); // 处理由get方法请求中文乱码问题
value=clearXss(value);
if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转码 if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转码
try { try {
value = new String(value.getBytes("ISO-8859-1"), Const.UTF8); value = new String(value.getBytes("ISO-8859-1"), Const.UTF8);
...@@ -383,11 +383,13 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -383,11 +383,13 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
StringBuilder urlParams=new StringBuilder(); StringBuilder urlParams=new StringBuilder();
searchMap.forEach((k,v)->{ searchMap.forEach((k,v)->{
//sql注入过滤 //sql注入过滤
searchMap.put(k,v.toString().replaceAll("('|\"|\\\\)","\\\\$1")); if(v!=null){
searchMap.put(k,clearXss(searchMap.get(k).toString())); searchMap.put(k,v.toString().replaceAll("('|\"|\\\\)","\\\\$1"));
if(!ParserUtil.SIZE.equals(k)&&!ParserUtil.PAGE_NO.equals(k)){ searchMap.put(k,clearXss(searchMap.get(k).toString()));
urlParams.append(k).append("=").append(searchMap.get(k)).append("&"); if(!ParserUtil.SIZE.equals(k)&&!ParserUtil.PAGE_NO.equals(k)){
} urlParams.append(k).append("=").append(searchMap.get(k)).append("&");
}
}
}); });
//查询数量 //查询数量
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment