fix: 修改 index.html 路径

This commit is contained in:
zhangshuai
2024-08-08 14:52:22 +08:00
parent e8b6e902c2
commit 519b6e1c2d

View File

@@ -11,6 +11,8 @@ import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
@@ -37,7 +39,7 @@ public class GUIHistoryRouterFilter extends OncePerRequestFilter {
if (!matches) {
// If the path does not start with any of the specified prefixes, return index.html
Resource resource = resourceLoader.getResource("classpath:./public/index.html");
Resource resource = resourceLoader.getResource("file:./public/index.html");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
Files.copy(resource.getFile().toPath(), response.getOutputStream());