From 53926a0e9772a0764bc28da801cd52c0c0986c4b Mon Sep 17 00:00:00 2001 From: Tobias Soloschenko Date: Mon, 23 Oct 2023 14:38:32 +0200 Subject: [PATCH] S3: Fix file listing if the prefix resolves to slash (#912) Fixes #900 --- .../cloud/s3/S3PathMatchingResourcePatternResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3PathMatchingResourcePatternResolver.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3PathMatchingResourcePatternResolver.java index 2bb3e9520..f45ec5cb2 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3PathMatchingResourcePatternResolver.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3PathMatchingResourcePatternResolver.java @@ -227,7 +227,7 @@ private ListObjectsV2Request.Builder getListObjectsV2RequestBuilder(String s3Buc PATH_DELIMITER)) .findFirst(); ListObjectsV2Request.Builder listObjectsV2RequestBuilder = ListObjectsV2Request.builder().bucket(s3BucketName); - if (optionalPrefix.isPresent()) { + if (optionalPrefix.isPresent() && !"/".equals(optionalPrefix.get())) { listObjectsV2RequestBuilder = listObjectsV2RequestBuilder.prefix(optionalPrefix.get()); } return listObjectsV2RequestBuilder;