From 098c650655766bb19991b7bccca1a109d60bbc5d Mon Sep 17 00:00:00 2001 From: Ming <5325253+ming21@user.noreply.gitee.com> Date: Tue, 24 Aug 2021 08:42:56 +0000 Subject: [PATCH] =?UTF-8?q?update=20ruoyi-common/src/main/java/com/ruoyi/c?= =?UTF-8?q?ommon/filter/XssHttpServletRequestWrapper.java.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0available=E6=96=B9=E6=B3=95=E4=BA=8EXssHttpServletRequ?= =?UTF-8?q?estWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/filter/XssHttpServletRequestWrapper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java index c0ab6e5..fa7b60b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -63,7 +63,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper // xss过滤 json = EscapeUtil.clean(json).trim(); - final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8")); + byte[] jsonBytes = json.getBytes("utf-8"); + final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); return new ServletInputStream() { @Override @@ -78,6 +79,11 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper return true; } + @Override + public int available() throws IOException { + return jsonBytes.length; + } + @Override public void setReadListener(ReadListener readListener) {