Skip to content

Commit cd0fc06

Browse files
authored
Set S3Presigner normalizePath and doubleUrlEncode to false (#4822)
* Set S3Presigner normalizePath and doubleUrlEncode to false * Set S3Presigner normalizePath and doubleUrlEncode to false
1 parent a38ee68 commit cd0fc06

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

services/s3/src/it/java/software/amazon/awssdk/services/s3/S3PresignerIntegrationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ public void keysWithScaryCharactersWorks() throws IOException {
118118
assertThatPresigningWorks(testBucket, scaryObjectKey);
119119
}
120120

121+
@Test
122+
public void keysWithDoubleBackslashWorks() throws IOException {
123+
String doubleBackslashKey = "key//image.png" + testGetObjectKey;
124+
S3TestUtils.putObject(S3PresignerIntegrationTest.class, client, testBucket, doubleBackslashKey, testObjectContent);
125+
126+
assertThatPresigningWorks(testBucket, doubleBackslashKey);
127+
}
128+
121129
private void assertThatPresigningWorks(String bucket, String objectKey) throws IOException {
122130
PresignedGetObjectRequest presigned =
123131
presigner.presignGetObject(r -> r.signatureDuration(Duration.ofMinutes(5))

services/s3/src/main/java/software/amazon/awssdk/services/s3/internal/signing/DefaultS3Presigner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ private <T extends Identity> SdkHttpFullRequest doSraPresign(SdkHttpFullRequest
585585
.putProperty(AwsV4FamilyHttpSigner.PAYLOAD_SIGNING_ENABLED, false)
586586
.putProperty(AwsV4FamilyHttpSigner.EXPIRATION_DURATION, expirationDuration)
587587
.putProperty(HttpSigner.SIGNING_CLOCK, signingClock)
588+
.putProperty(AwsV4FamilyHttpSigner.NORMALIZE_PATH, false)
589+
.putProperty(AwsV4FamilyHttpSigner.DOUBLE_URL_ENCODE, false)
588590
.request(request)
589591
.payload(request.contentStreamProvider().orElse(null));
590592
AuthSchemeOption authSchemeOption = selectedAuthScheme.authSchemeOption();

0 commit comments

Comments
 (0)