From fb9058612221f5ba72878755876bb067baba8a94 Mon Sep 17 00:00:00 2001 From: plat1ko Date: Sat, 30 Jul 2022 18:31:32 +0800 Subject: [PATCH] Fix bug in s3 delete directory (#11344) --- be/src/io/fs/s3_file_system.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/be/src/io/fs/s3_file_system.cpp b/be/src/io/fs/s3_file_system.cpp index 65d6a27de7..575a51302b 100644 --- a/be/src/io/fs/s3_file_system.cpp +++ b/be/src/io/fs/s3_file_system.cpp @@ -174,6 +174,9 @@ Status S3FileSystem::delete_directory(const Path& path) { Aws::S3::Model::ListObjectsV2Request request; auto prefix = get_key(path); + if (!prefix.empty() && prefix.back() != '/') { + prefix.push_back('/'); + } request.WithBucket(_s3_conf.bucket).WithPrefix(prefix); Aws::S3::Model::DeleteObjectsRequest delete_request;