Skip to content

Commit

Permalink
fix: correctly presign S3 requests when forcePathStyle = true
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbotsf committed Jan 9, 2024
1 parent e98fd12 commit 5b87099
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .changes/c0f971d2-3b76-4f9a-9c76-dc89fe395c86.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "c0f971d2-3b76-4f9a-9c76-dc89fe395c86",
"type": "bugfix",
"description": "Correctly presign S3 requests when `forcePathStyle = true`",
"issues": [
"awslabs/aws-sdk-kotlin#1173"
]
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ coroutines-version = "1.7.3"
atomicfu-version = "0.23.1"

# smithy-kotlin codegen and runtime are versioned separately
smithy-kotlin-runtime-version = "1.0.7"
smithy-kotlin-codegen-version = "0.30.8"
smithy-kotlin-runtime-version = "1.0.8-SNAPSHOT"
smithy-kotlin-codegen-version = "0.30.9-SNAPSHOT"

# codegen
smithy-version = "1.42.0"
Expand Down
19 changes: 17 additions & 2 deletions services/s3/e2eTest/src/S3PresignerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import aws.smithy.kotlin.runtime.http.SdkHttpClient
import aws.smithy.kotlin.runtime.http.complete
import aws.smithy.kotlin.runtime.http.toByteStream
import kotlinx.coroutines.*
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.TestInstance
Expand All @@ -42,8 +43,7 @@ class S3PresignerTest {
client.close()
}

@Test
fun testPresign() = runBlocking {
private suspend fun testPresign(client: S3Client) {
val contents = "presign-test"
val keyName = "foo$PRINTABLE_CHARS"

Expand Down Expand Up @@ -71,4 +71,19 @@ class S3PresignerTest {
assertEquals(contents, body)
}
}

@Test
fun testPresignNormal() = runTest {
S3Client {
region = S3TestUtils.DEFAULT_REGION
}.use { testPresign(it) }
}

@Test
fun testPresignWithForcePathStyle() = runBlocking {
S3Client {
region = S3TestUtils.DEFAULT_REGION
forcePathStyle = true
}.use { testPresign(it) }
}
}

0 comments on commit 5b87099

Please sign in to comment.