Apache Solr open-source search software
SOLR-16670: Fix 404 error in S3 directory check (#1373)
Houston Putman7bdebb2bd025
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 3c1768e458e..e943fa1c3d6 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -217,7 +217,9 @@ Bug Fixes* SOLR-9698: Fix start/stop wait time and RMI_PORT on Windows (Colvin Cowie)-SOLR-16653: Shard split on PRS collections with NRT + PULL replicas lead to down replicas (Hitesh Khamesra via noble)+* SOLR-16653: Shard split on PRS collections with NRT + PULL replicas lead to down replicas (Hitesh Khamesra via noble)++* SOLR-16670: Fix directory/file check in S3Repository (Houston Putman, Hakan Özler)Build---------------------diff --git a/solr/modules/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java b/solr/modules/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.javaindex 34dc20790b0..0b54cfe8cf7 100644--- a/solr/modules/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java+++ b/solr/modules/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java@@ -329,6 +329,8 @@ public class S3StorageClient {String contentType = objectMetadata.contentType();return !StringUtils.isEmpty(contentType) && contentType.equalsIgnoreCase(S3_DIR_CONTENT_TYPE);+ } catch (NoSuchKeyException nske) {+ return false;} catch (SdkException sdke) {throw handleAmazonException(sdke);}diff --git a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3PathsTest.java b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3PathsTest.javaindex 8275bf597e0..4b3a0c9d3f2 100644--- a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3PathsTest.java+++ b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3PathsTest.java@@ -39,6 +39,8 @@ public class S3PathsTest extends AbstractS3ClientTest {pushContent("/simple-file", "blah");assertTrue("File should exist without a leading slash", client.pathExists("simple-file"));assertTrue("File should exist with a leading slash", client.pathExists("/simple-file"));++ assertFalse("File should not be considered a directory", client.isDirectory("/simple-file"));}/** Simple tests with a directory. */