Skip to content

Commit 7d2e3f0

Browse files
author
Anirav Kareddy
committed
Added a note to the javadoc comment for the setter for instructionFileSuffix to mention that the . prefix is automatically added to the suffix + in reEncryptInstructionFileResponse, the . prefix will be removed from the suffix and return what the user requested the suffix be
1 parent b36455a commit 7d2e3f0

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/main/java/software/amazon/encryption/s3/internal/ReEncryptInstructionFileRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public Builder newKeyring(RawKeyring newKeyring) {
110110
* Sets a custom instruction file suffix for the re-encrypted instruction file.
111111
* For AES keyrings, only the default instruction file suffix is allowed.
112112
* For RSA keyrings, both the default and custom instruction file suffixes are allowed.
113+
* Note: The "." prefix is automatically added to the suffix
113114
*
114115
* @param instructionFileSuffix the instruction file suffix
115116
* @return a reference to this object so that method calls can be chained together.

src/main/java/software/amazon/encryption/s3/internal/ReEncryptInstructionFileResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ReEncryptInstructionFileResponse {
2121
public ReEncryptInstructionFileResponse(String bucket, String key, String instructionFileSuffix) {
2222
this.bucket = bucket;
2323
this.key = key;
24-
this.instructionFileSuffix = instructionFileSuffix;
24+
this.instructionFileSuffix = instructionFileSuffix.substring(1);
2525
}
2626

2727
/**

src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public void testAesKeyringReEncryptInstructionFile() {
286286

287287
assertEquals(BUCKET, response.bucket());
288288
assertEquals(objectKey, response.key());
289-
assertEquals(".instruction", response.instructionFileSuffix());
289+
assertEquals("instruction", response.instructionFileSuffix());
290290

291291
S3Client rotatedWrappedClient = S3Client.create();
292292

@@ -410,7 +410,7 @@ public void testRsaKeyringReEncryptInstructionFile() {
410410

411411
assertEquals(BUCKET, response.bucket());
412412
assertEquals(objectKey, response.key());
413-
assertEquals(".instruction", response.instructionFileSuffix());
413+
assertEquals("instruction", response.instructionFileSuffix());
414414

415415
S3Client rotatedWrappedClient = S3Client.create();
416416

@@ -530,7 +530,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffix() {
530530

531531
assertEquals(BUCKET, reEncryptInstructionFileResponse.bucket());
532532
assertEquals(objectKey, reEncryptInstructionFileResponse.key());
533-
assertEquals(".third-party-access-instruction-file", reEncryptInstructionFileResponse.instructionFileSuffix());
533+
assertEquals("third-party-access-instruction-file", reEncryptInstructionFileResponse.instructionFileSuffix());
534534

535535
ResponseBytes<GetObjectResponse> clientInstructionFile= wrappedClient.getObjectAsBytes(builder -> builder
536536
.bucket(BUCKET)
@@ -1671,7 +1671,4 @@ public void testReEncryptInstructionFileUpgradesV1RsaEncryptionOnlyToV3() throws
16711671
deleteObject(BUCKET, objectKey, v3OriginalClient);
16721672
}
16731673

1674-
1675-
1676-
16771674
}

0 commit comments

Comments
 (0)