From 293578fa0c5c179fea1b4d001a6ca185081a30f4 Mon Sep 17 00:00:00 2001 From: yaoxuwan Date: Mon, 16 Dec 2024 10:10:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95=E9=94=99=E8=AF=AF=20#2849?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/bkrepo/common/storage/util/PathExtensions.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/common/common-storage/storage-service/src/main/kotlin/com/tencent/bkrepo/common/storage/util/PathExtensions.kt b/src/backend/common/common-storage/storage-service/src/main/kotlin/com/tencent/bkrepo/common/storage/util/PathExtensions.kt index fd38507300..d6539da970 100644 --- a/src/backend/common/common-storage/storage-service/src/main/kotlin/com/tencent/bkrepo/common/storage/util/PathExtensions.kt +++ b/src/backend/common/common-storage/storage-service/src/main/kotlin/com/tencent/bkrepo/common/storage/util/PathExtensions.kt @@ -36,6 +36,7 @@ import java.io.File import java.io.FileNotFoundException import java.io.OutputStream import java.nio.file.DirectoryIteratorException +import java.nio.file.DirectoryNotEmptyException import java.nio.file.FileSystemException import java.nio.file.Files import java.nio.file.Path @@ -94,6 +95,9 @@ fun Path.delete(): Boolean { } else { throw e } + } catch (e: DirectoryNotEmptyException) { + logger.info("delete dir[$this] failed: ${e.message}") + return false } // 目录还存在内容 return false