From e3b264e5f18e48bcdb21e0f0e549fba2891d67c0 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 14 Oct 2022 17:46:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017976 --user=陈建星 【测试跟踪】测试用例-添加附件-上传本地文件-预览提示加载失败 https://www.tapd.cn/55049933/s/1261722 --bug=1017976 --user=陈建星 【测试跟踪】测试用例-添加附件-上传本地文件-预览提示加载失败 https://www.tapd.cn/55049933/s/1261970 --- .../java/io/metersphere/gateway/filter/SessionFilter.java | 2 +- framework/sdk-parent/frontend/src/plugins/request.js | 8 ++++++++ .../java/io/metersphere/commons/utils/ShiroUtils.java | 3 +-- .../src/business/case/components/TestCaseFile.vue | 5 ++++- test-track/frontend/src/business/utils/sdk-utils.js | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java b/framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java index c65a441ac2..e0461b0276 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java @@ -18,7 +18,7 @@ import java.util.Optional; public class SessionFilter implements WebFilter { // 所有模块的前缀 private static final String[] PREFIX = new String[]{"/setting", "/project", "/api", "/performance", "/track", "/workstation", "/ui", "/report"}; - private static final String[] TO_SUB_SERVICE = new String[]{"/license", "/system"}; + private static final String[] TO_SUB_SERVICE = new String[]{"/license", "/system", "/resource"}; private static final String PERFORMANCE_DOWNLOAD_PREFIX = "/jmeter/"; private static final String API_DOWNLOAD_PREFIX = "/api/jmeter/"; diff --git a/framework/sdk-parent/frontend/src/plugins/request.js b/framework/sdk-parent/frontend/src/plugins/request.js index ec0455ace8..d8e73d38fa 100644 --- a/framework/sdk-parent/frontend/src/plugins/request.js +++ b/framework/sdk-parent/frontend/src/plugins/request.js @@ -268,6 +268,14 @@ export const generateShareUrl = (name, shareUrl) => { } } +export const generateModuleUrl = (url) => { + if (window.__POWERED_BY_QIANKUN__) { + return window.location.origin + '/' + packageJSON.name + url; + } else { + return window.location.origin + url; + } +} + export default { install(Vue) { Vue.prototype.$get = get; diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/ShiroUtils.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/ShiroUtils.java index e38798ce7f..30207e3fff 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/ShiroUtils.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/ShiroUtils.java @@ -17,6 +17,7 @@ public class ShiroUtils { filterChainDefinitionMap.put("/resource/md/get/**", "anon"); filterChainDefinitionMap.put("/resource/ui/get/**", "anon"); + filterChainDefinitionMap.put("/attachment/preview/**", "anon"); filterChainDefinitionMap.put("/*.worker.js", "anon"); filterChainDefinitionMap.put("/signin", "anon"); filterChainDefinitionMap.put("/ldap/signin", "anon"); @@ -90,8 +91,6 @@ public class ShiroUtils { public static void ignoreCsrfFilter(Map filterChainDefinitionMap) { filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf filterChainDefinitionMap.put("/language", "apikey, authc");// 跳转到 /language 不用校验 csrf - filterChainDefinitionMap.put("/test/case/file/preview/**", "apikey, authc"); // 预览测试用例附件 不用校验 csrf - filterChainDefinitionMap.put("/attachment/preview/**", "apikey, authc"); // 预览缺陷及测试用例附件 不用校验 csrf filterChainDefinitionMap.put("/mock", "apikey, authc"); // 跳转到 /mock接口 不用校验 csrf } diff --git a/test-track/frontend/src/business/case/components/TestCaseFile.vue b/test-track/frontend/src/business/case/components/TestCaseFile.vue index bf292c8576..662752526e 100644 --- a/test-track/frontend/src/business/case/components/TestCaseFile.vue +++ b/test-track/frontend/src/business/case/components/TestCaseFile.vue @@ -1,7 +1,7 @@