From 933cb304436f5499cecba88c588afd87bafb0b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Tue, 10 Jan 2023 15:02:02 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9AglobalConfig=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/tiesheng/util/config/GlobalConfig.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tiesheng-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java b/tiesheng-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java index 61a59e9..e682ab8 100644 --- a/tiesheng-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java +++ b/tiesheng-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java @@ -1,5 +1,6 @@ package com.tiesheng.util.config; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import cn.hutool.log.LogFactory; @@ -66,10 +67,12 @@ public class GlobalConfig { if (resources.length == 0) { throw new ApiException("无法重定向,请检查资源"); } - String filename = resources[resources.length - 1].getFile().getPath(); + String filename = resources[resources.length - 1].getURL().getPath(); + filename = FileUtil.normalize(filename); String path = buildPath(String.format("/%s%s#%s", htmlDir, StrUtil.subAfter(filename, htmlDir, true), route)); response.sendRedirect(path); - } catch (IOException ignored) { + } catch (IOException e) { + LogFactory.get().info(e); } }