优化代码

This commit is contained in:
RuoYi
2023-08-14 19:19:35 +08:00
parent 1994aff544
commit a416d55780
2 changed files with 8 additions and 13 deletions

View File

@@ -87,7 +87,7 @@ public class XssFilter implements GlobalFilter, Ordered
// 防xss攻击过滤
bodyStr = EscapeUtil.clean(bodyStr);
// 转成字节
byte[] bytes = bodyStr.getBytes();
byte[] bytes = bodyStr.getBytes(StandardCharsets.UTF_8);
NettyDataBufferFactory nettyDataBufferFactory = new NettyDataBufferFactory(ByteBufAllocator.DEFAULT);
DataBuffer buffer = nettyDataBufferFactory.allocateBuffer(bytes.length);
buffer.write(bytes);