Browse Source

!76 修复安全限制 代码继续执行的问题
Merge pull request !76 from 高雄/master

kailing 2 years ago
parent
commit
b5e281a3b1

+ 1 - 0
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);

+ 1 - 1
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) {

+ 3 - 1
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