Skip to content

Commit 46f4fda

Browse files
committed
Include underscore as valid region char; lint
1 parent 0e44c8c commit 46f4fda

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/region/ValidateRegion.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.runtime.region
26

37
import aws.sdk.kotlin.runtime.ConfigurationException
@@ -9,7 +13,7 @@ internal fun charSet(range: CharRange) = range.toSet()
913
private object Rfc3986CharSets {
1014
val alpha = charSet('A'..'Z') + charSet('a'..'z')
1115
val digit = charSet('0'..'9')
12-
val unreserved = alpha + digit + charSet("-.+~")
16+
val unreserved = alpha + digit + charSet("-._~")
1317
val hexdig = digit + charSet('A'..'F')
1418
val pctEncoded = hexdig + '%'
1519
val subDelims = charSet("!$&'()*+,;=")

aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/region/ValidateRegionTest.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.runtime.region
26

37
import aws.sdk.kotlin.runtime.ConfigurationException
@@ -28,7 +32,7 @@ private fun combinations(ofSet: Set<Char>, length: Int): Set<String> {
2832
}
2933

3034
private object TestData {
31-
private val validChars = charSet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.+~%!$&'()*+,;=")
35+
private val validChars = charSet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%!$&'()*+,;=")
3236

3337
/**
3438
* Non-exhaustive set of [actual AWS regions][1].
@@ -106,4 +110,4 @@ class ValidateRegionTest {
106110
}
107111
}
108112
}
109-
}
113+
}

0 commit comments

Comments
 (0)