diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt index ad33660d4d..371093084c 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt @@ -136,13 +136,12 @@ class SeparationTaskServiceImpl( ) { var flag = false val projectRepoKey = "${projectId}/${repoName}" -// dataSeparationConfig.specialRestoreRepos.forEach { -// val regex = Regex(it.replace("*", ".*")) -// if (regex.matches(projectRepoKey)) { -// flag = true -// } -// } - flag = true + dataSeparationConfig.specialRestoreRepos.forEach { + val regex = Regex(it.replace("*", ".*")) + if (regex.matches(projectRepoKey)) { + flag = true + } + } if (!flag) throw BadRequestException( CommonMessageCode.PARAMETER_INVALID, projectRepoKey @@ -212,13 +211,12 @@ class SeparationTaskServiceImpl( var flag = false val projectRepoKey = "$projectId/$repoName" -// dataSeparationConfig.specialSeparateRepos.forEach { -// val regex = Regex(it.replace("*", ".*")) -// if (regex.matches(projectRepoKey)) { -// flag = true -// } -// } - flag = true + dataSeparationConfig.specialSeparateRepos.forEach { + val regex = Regex(it.replace("*", ".*")) + if (regex.matches(projectRepoKey)) { + flag = true + } + } if (!flag) throw BadRequestException( CommonMessageCode.PARAMETER_INVALID, projectRepoKey @@ -250,14 +248,14 @@ class SeparationTaskServiceImpl( RepositoryType.GENERIC -> SeparationArtifactType.NODE else -> SeparationArtifactType.PACKAGE } -// if (!request.content.packages.isNullOrEmpty() && separationArtifactType == SeparationArtifactType.NODE) { -// logger.warn("Separation content [${request.content}] is illegal!") -// throw BadRequestException(CommonMessageCode.PARAMETER_INVALID) -// } -// if (!request.content.paths.isNullOrEmpty() && separationArtifactType == SeparationArtifactType.PACKAGE) { -// logger.warn("Separation content [${request.content}] is illegal!") -// throw BadRequestException(CommonMessageCode.PARAMETER_INVALID) -// } + if (!request.content.packages.isNullOrEmpty() && separationArtifactType == SeparationArtifactType.NODE) { + logger.warn("Separation content [${request.content}] is illegal!") + throw BadRequestException(CommonMessageCode.PARAMETER_INVALID) + } + if (!request.content.paths.isNullOrEmpty() && separationArtifactType == SeparationArtifactType.PACKAGE) { + logger.warn("Separation content [${request.content}] is illegal!") + throw BadRequestException(CommonMessageCode.PARAMETER_INVALID) + } } private fun buildSeparationTask(