This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new d192626dd69 SOLR-16670: Fix 404 error in S3 directory check (#1373)
d192626dd69 is described below

commit d192626dd69a07b63f19955ff0745a326c1ab4d4
Author: Houston Putman <[email protected]>
AuthorDate: Tue Feb 21 17:35:01 2023 -0800

    SOLR-16670: Fix 404 error in S3 directory check (#1373)
    
    (cherry picked from commit 7bdebb2bd02584eb39761ba5ac563c214ba5c901)
---
 solr/CHANGES.txt                                                      | 4 +++-
 .../s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java    | 2 ++
 .../s3-repository/src/test/org/apache/solr/s3/S3PathsTest.java        | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8caea375f31..46017afe0d9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -187,7 +187,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.java
index 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.java
index 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. */

Reply via email to