smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
79 stars 26 forks source link

Url.parse(url: String) strips @ in scenarios it shouldn't #1031

Closed tylerjroach closed 8 months ago

tylerjroach commented 8 months ago

Describe the bug

Url.parse is not properly parsing urls that have the @ symbol outside of the authority portion of the provided string url.

https://github.com/awslabs/smithy-kotlin/blob/b2350449f70a78f3c4c647f251b49d1cfc0b57e4/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/net/url/Url.kt#L53

Take the example url below: https://<domain>.com/images/test@2x.png

Expected Behavior

Url.parse properly converts the example link above into an equal representation in the Url class.

Current Behavior

Url.parse strips the @ symbol from url, regardless of location. It appears to be due to assuming the provided string is an email. However, there are valid usages of @ in urls. A common example would be requesting a specific image size, as is seen in one of our libraries.

Steps to Reproduce

Url.parse("https://<domain>.com/images/test@2x.png"

Your Environment