Skip to content

Commit

Permalink
SOLR-16670: Fix 404 error in S3 directory check (#1373)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7bdebb2)
  • Loading branch information
HoustonPutman committed Feb 22, 2023
1 parent 762ab9b commit d192626
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ boolean isDirectory(String path) throws S3Exception {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public void testFiles() throws S3Exception {
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. */
Expand Down

0 comments on commit d192626

Please sign in to comment.