From e5ae903ea8e1b83ed641bbdbc064c7cbb9341c79 Mon Sep 17 00:00:00 2001 From: kunlongli <16629885+cnlkl@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:05:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=9C=89=E6=9D=83=E9=99=90=E8=B7=AF=E5=BE=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20#2515?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/bkrepo/repository/util/NodeQueryHelper.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/util/NodeQueryHelper.kt b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/util/NodeQueryHelper.kt index f634a784ef..ca95543580 100644 --- a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/util/NodeQueryHelper.kt +++ b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/util/NodeQueryHelper.kt @@ -28,6 +28,7 @@ package com.tencent.bkrepo.repository.util import com.tencent.bkrepo.auth.api.ServicePermissionClient +import com.tencent.bkrepo.common.api.constant.ensureSuffix import com.tencent.bkrepo.common.artifact.path.PathUtils import com.tencent.bkrepo.common.artifact.path.PathUtils.escapeRegex import com.tencent.bkrepo.common.artifact.path.PathUtils.toFullPath @@ -297,7 +298,7 @@ object NodeQueryHelper { } private fun buildNoPermissionPathCriteria(paths: List) = paths.flatMap { - listOf(TNode::fullPath.isEqualTo(it), TNode::fullPath.regex("^${escapeRegex(it)}")) + listOf(TNode::fullPath.isEqualTo(it), TNode::fullPath.regex("^${escapeRegex(it).ensureSuffix("/")}")) } private fun buildHasPermissionPathCriteria(paths: List) = paths.flatMap { path -> @@ -306,7 +307,7 @@ object NodeQueryHelper { // 拥有文件权限时将自动拥有父目录查看权限,在前端或者bk-driver中才能查看子目录及文件 parentFolders.forEach { criteriaList.add(TNode::fullPath.isEqualTo(it)) } criteriaList.add(TNode::fullPath.isEqualTo(path)) - criteriaList.add(TNode::fullPath.regex("^${escapeRegex(path)}")) + criteriaList.add(TNode::fullPath.regex("^${escapeRegex(path).ensureSuffix("/")}")) criteriaList }