encode fix
This commit is contained in:
@@ -25,6 +25,6 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<?> handleException(Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(Map.of("success", false, "message", "æœ<EFBFBD>务器内部错è¯? " + e.getMessage()));
|
||||
.body(Map.of("success", false, "message", "服务器内部错误: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class FullApiFilter implements Filter {
|
||||
String method = wrappedRequest.getMethod();
|
||||
String params;
|
||||
|
||||
// 登录接å<EFBFBD>£ç™»å½•æˆ<EFBFBD>功(状æ€<EFBFBD>ç <EFBFBD> 2xx)时ä¸<C3A4>记录å<E280A2>‚数,仅记录失败日å¿?
|
||||
// 登录接口登录成功(状态码 2xx)时不记录参数,仅记录失败日志
|
||||
if ("/access/login".equals(servletPath) && httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
|
||||
params = "[PROTECTED]";
|
||||
} else {
|
||||
@@ -84,7 +84,7 @@ public class FullApiFilter implements Filter {
|
||||
opLog.setUsername(auth.getName());
|
||||
}
|
||||
|
||||
// 记录å<EFBFBD>¯èƒ½çš„异常信æ<EFBFBD>?
|
||||
// 记录可能的异常信息
|
||||
Object exception = req.getAttribute("filter_exception");
|
||||
if (exception != null) {
|
||||
opLog.setException(exception.toString());
|
||||
@@ -143,4 +143,4 @@ public class FullApiFilter implements Filter {
|
||||
return ip;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -85,14 +85,14 @@ public class BaseEncoder {
|
||||
return java.net.URLEncoder.encode(target, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
// é‡<EFBFBD>载方法,ä¿<EFBFBD>æŒ<EFBFBD>å<EFBFBD>‘å<EFBFBD>Žå…¼å®?
|
||||
// 重载方法,保持向后兼容
|
||||
public static String encodeByTarget(String target) {
|
||||
return encodeByTarget(target, Algorithm.REMOVE_SPECIAL_CHARS);
|
||||
}
|
||||
|
||||
// 工具方法:验è¯<EFBFBD>ç¼–ç <EFBFBD>结æž?
|
||||
// 工具方法:验证编码结果
|
||||
public static boolean verify(String original, String encoded, Algorithm algorithm) {
|
||||
String newEncoded = encodeByTarget(original, algorithm);
|
||||
return newEncoded.equals(encoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user