Browse Source

!76 修复安全限制 代码继续执行的问题

Merge pull request !76 from 高雄/master
pull/77/MERGE
kailing 2 years ago committed by Gitee
parent
commit
b5e281a3b1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
  1. 1
      server/src/main/java/cn/keking/config/WebConfig.java
  2. 2
      server/src/main/java/cn/keking/utils/DownloadUtils.java
  3. 4
      server/src/main/java/cn/keking/web/filter/TrustHostFilter.java

1
server/src/main/java/cn/keking/config/WebConfig.java

@ -43,6 +43,7 @@ public class WebConfig implements WebMvcConfigurer {
Set<String> filterUri = new HashSet<>();
filterUri.add("/onlinePreview");
filterUri.add("/picturesPreview");
filterUri.add("/getCorsFile");
TrustHostFilter filter = new TrustHostFilter();
FilterRegistrationBean<TrustHostFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(filter);

2
server/src/main/java/cn/keking/utils/DownloadUtils.java

@ -75,7 +75,7 @@ public class DownloadUtils {
response.setMsg(fileName);
return response;
} catch (IOException | GalimatiasParseException e) {
logger.error("文件下载失败,url:{}", urlStr, e);
logger.error("文件下载失败,url:{}", urlStr);
response.setCode(1);
response.setContent(null);
if (e instanceof FileNotFoundException) {

4
server/src/main/java/cn/keking/web/filter/TrustHostFilter.java

@ -42,7 +42,9 @@ public class TrustHostFilter implements Filter {
response.getWriter().write(html);
response.getWriter().close();
}
chain.doFilter(request, response);
else {
chain.doFilter(request, response);
}
}
@Override

Loading…
Cancel
Save