Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -228,10 +227,13 @@ private String parseBucketFromHost(String host) {
if (service.contains("s3-accesspoint") || service.contains("s3-outposts")
|| service.contains("s3-object-lambda")) {
// If AccessPoint then bucketName is of format `accessPoint-accountId`;
String[] accessPointBits = hostBits[0].split("-");
int lastElem = accessPointBits.length - 1;
String accountId = accessPointBits[lastElem];
String accessPointName = String.join("", Arrays.copyOf(accessPointBits, lastElem));
String[] accessPointBits = bucketName.split("-");
String accountId = accessPointBits[accessPointBits.length - 1];
// Extract the access point name from bucket name. eg: if bucket name is
// test-custom-signer-<accountId>, get the access point name test-custom-signer by removing
// -<accountId> from the bucket name.
String accessPointName =
bucketName.substring(0, bucketName.length() - (accountId.length() + 1));
Arn arn = Arn.builder()
.withAccountId(accountId)
.withPartition("aws")
Expand Down