File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -228,10 +228,13 @@ private String parseBucketFromHost(String host) {
228228 if (service .contains ("s3-accesspoint" ) || service .contains ("s3-outposts" )
229229 || service .contains ("s3-object-lambda" )) {
230230 // If AccessPoint then bucketName is of format `accessPoint-accountId`;
231- String [] accessPointBits = hostBits [0 ].split ("-" );
232- int lastElem = accessPointBits .length - 1 ;
233- String accountId = accessPointBits [lastElem ];
234- String accessPointName = String .join ("" , Arrays .copyOf (accessPointBits , lastElem ));
231+ String [] accessPointBits = bucketName .split ("-" );
232+ String accountId = accessPointBits [accessPointBits .length - 1 ];
233+ // Extract the access point name from bucket name. eg: if bucket name is
234+ // test-custom-signer-<accountId>, get the access point name test-custom-signer by removing
235+ // -<accountId> from the bucket name.
236+ String accessPointName =
237+ bucketName .substring (0 , bucketName .length () - (accountId .length () + 1 ));
235238 Arn arn = Arn .builder ()
236239 .withAccountId (accountId )
237240 .withPartition ("aws" )
You can’t perform that action at this time.
0 commit comments