From 01210ad34357516a77cc616edaae15054ee55eb0 Mon Sep 17 00:00:00 2001 From: felixncheng Date: Thu, 21 Nov 2024 10:22:30 +0800 Subject: [PATCH] =?UTF-8?q?bug:=20=E4=BF=AE=E5=A4=8DGitRepoInterceptor?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=20#2755?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/bkrepo/git/interceptor/ProxyInterceptor.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/git/biz-git/src/main/kotlin/com/tencent/bkrepo/git/interceptor/ProxyInterceptor.kt b/src/backend/git/biz-git/src/main/kotlin/com/tencent/bkrepo/git/interceptor/ProxyInterceptor.kt index 4d9ff434e6..7fed0aa58c 100644 --- a/src/backend/git/biz-git/src/main/kotlin/com/tencent/bkrepo/git/interceptor/ProxyInterceptor.kt +++ b/src/backend/git/biz-git/src/main/kotlin/com/tencent/bkrepo/git/interceptor/ProxyInterceptor.kt @@ -22,9 +22,9 @@ class ProxyInterceptor : HandlerInterceptor { override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE) ?: return false - val repo = ArtifactContextHolder.getRepoDetail()!! + val repo = ArtifactContextHolder.getRepoDetailOrNull() // 只有PROXY类型的仓库才进行拦截 - if (repo.category != RepositoryCategory.PROXY) { + if (repo == null || repo.category != RepositoryCategory.PROXY) { return true } val projectId = repo.projectId