Skip to content

Commit

Permalink
feat: 缓存额外保留配置支持设置文件后缀 #2002
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Jun 7, 2024
1 parent 1b9d4cf commit 15602ff
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ class BasedRepositoryFileExpireResolver(
val sha256 = ret[SHA256].toString()
val fullPath = ret[FULL_PATH].toString()
var fileExtensionCheck = true
it.fileExtension?.let {
if (!it.contains("/") && !it.any { fullPath.endsWith(it) }) {
fileExtensionCheck = false
}
}
it.fileExtension?.let { fileExtensionCheck = checkFileExtension(it, fullPath) }
if (fileExtensionCheck) {
temp.add(sha256)
logger.info("Retain node $projectId/$repoName$fullPath, $sha256.")
Expand All @@ -108,6 +104,14 @@ class BasedRepositoryFileExpireResolver(
return temp
}

private fun checkFileExtension(fileExtension: List<String> , fullPath: String ) : Boolean {
var fileExtensionCheck = true
if (!fileExtension.contains("/") && !fileExtension.any { fullPath.endsWith(it) }) {
fileExtensionCheck = false
}
return fileExtensionCheck
}

private fun convertRepoConfigToFileCache(repoConfig: RepoConfig):TFileCache {
return TFileCache(
id = null,
Expand Down

0 comments on commit 15602ff

Please sign in to comment.