From b11851c3e337bfd4062a1e0fd95715c38084468b Mon Sep 17 00:00:00 2001 From: sshx Date: Wed, 31 Jul 2024 13:22:30 +0800 Subject: [PATCH 1/5] fix bug:upload file --- src/main/java/com/jiaruiblog/filter/JwtFilter.java | 8 +++++++- src/main/resources/application.yml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jiaruiblog/filter/JwtFilter.java b/src/main/java/com/jiaruiblog/filter/JwtFilter.java index 843e9be..3acd35d 100644 --- a/src/main/java/com/jiaruiblog/filter/JwtFilter.java +++ b/src/main/java/com/jiaruiblog/filter/JwtFilter.java @@ -44,7 +44,13 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) response.setCharacterEncoding("UTF-8"); String url = request.getRequestURI().substring(request.getContextPath().length()); // 登录和注册等请求不需要令牌 - if (url.contains("login") || url.contains("/user/insert") || url.contains("files")) { +// if (url.contains("login") || url.contains("/user/insert") || url.contains("files")) { +// response.setStatus(HttpServletResponse.SC_OK); +// chain.doFilter(request, response); +// return; +// } + + if (url.contains("login") || url.contains("/user/insert")) { response.setStatus(HttpServletResponse.SC_OK); chain.doFilter(request, response); return; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7fac01e..fdfa2f1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -18,7 +18,7 @@ spring: redis: database: 0 host: ${REDIS_HOST:127.0.0.1} - password: ${REDIS_PWD} + password: ${REDIS_PWD:123} port: ${REDIS_PORT:6379} timeout: 3000 jedis: From 7f5af3f9a33f9fc5450aa5e2ce2cde58dd95cb3a Mon Sep 17 00:00:00 2001 From: sshx Date: Wed, 31 Jul 2024 15:36:05 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix=5Fbug:=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=92=8C=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88=20?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jiaruiblog/filter/JwtFilter.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/jiaruiblog/filter/JwtFilter.java b/src/main/java/com/jiaruiblog/filter/JwtFilter.java index 3acd35d..fae956b 100644 --- a/src/main/java/com/jiaruiblog/filter/JwtFilter.java +++ b/src/main/java/com/jiaruiblog/filter/JwtFilter.java @@ -44,13 +44,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) response.setCharacterEncoding("UTF-8"); String url = request.getRequestURI().substring(request.getContextPath().length()); // 登录和注册等请求不需要令牌 -// if (url.contains("login") || url.contains("/user/insert") || url.contains("files")) { -// response.setStatus(HttpServletResponse.SC_OK); -// chain.doFilter(request, response); -// return; -// } - - if (url.contains("login") || url.contains("/user/insert")) { + if (url.contains("login") || url.contains("/user/insert") || url.contains("view")) { response.setStatus(HttpServletResponse.SC_OK); chain.doFilter(request, response); return; From 7f610d09eb59d5feb3030677a719dad6e119b131 Mon Sep 17 00:00:00 2001 From: sshx Date: Thu, 1 Aug 2024 09:05:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix=5Fbug:=E8=A7=A3=E5=86=B3=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=96=87=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jiaruiblog/filter/JwtFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jiaruiblog/filter/JwtFilter.java b/src/main/java/com/jiaruiblog/filter/JwtFilter.java index fae956b..e7f870c 100644 --- a/src/main/java/com/jiaruiblog/filter/JwtFilter.java +++ b/src/main/java/com/jiaruiblog/filter/JwtFilter.java @@ -44,7 +44,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) response.setCharacterEncoding("UTF-8"); String url = request.getRequestURI().substring(request.getContextPath().length()); // 登录和注册等请求不需要令牌 - if (url.contains("login") || url.contains("/user/insert") || url.contains("view")) { + if (url.contains("login") || url.contains("/user/insert") || url.contains("/files/view") || url.contains("/files/image2")) { response.setStatus(HttpServletResponse.SC_OK); chain.doFilter(request, response); return; From c995c16ec63f58e683046e314f2ead8c4277addc Mon Sep 17 00:00:00 2001 From: sshx Date: Thu, 1 Aug 2024 09:06:56 +0800 Subject: [PATCH 4/5] yml --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fdfa2f1..5b078ee 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -18,7 +18,7 @@ spring: redis: database: 0 host: ${REDIS_HOST:127.0.0.1} - password: ${REDIS_PWD:123} + password: ${REDIS_PWD:} port: ${REDIS_PORT:6379} timeout: 3000 jedis: From f2f2ec591c9ec150939d6f54d75b2e37256407c4 Mon Sep 17 00:00:00 2001 From: sshx Date: Thu, 1 Aug 2024 09:07:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5b078ee..7fac01e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -18,7 +18,7 @@ spring: redis: database: 0 host: ${REDIS_HOST:127.0.0.1} - password: ${REDIS_PWD:} + password: ${REDIS_PWD} port: ${REDIS_PORT:6379} timeout: 3000 jedis: