aws / aws/aws-sdk-java-v2

S3Utilities.parseUri(): support unencoded URI

オープン
#3,955 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature-request p2
主要言語
Java
スター
2.6k
フォーク
1k
平均マージ
2日 9時間
マージ済み PR(30日)
51

説明

### Describe the bug

I currently have an S3 object with the S3 URI `s3://test-bucket/test file with spaces`. When I attempt to create an `S3Uri` object with the `parseUri()` method ([code](https://github.com/aws/aws-sdk-java-v2/blob/b0f57372dbe6be1fb2a6a54b05ad1f1a7e1e7700/services/s3/src/main/java/software/amazon/awssdk/services/s3/S3Utilities.java#L292)), I receive the following exception:

```kotlin
// Code with S3 client from v2 SDK
val s3Uri = s3Client.utilities().parseUri(URI("s3://test-bucket/test file with spaces"))

// Exception
Caused by: java.net.URISyntaxException: Illegal character in path at index 21: s3://test-bucket/test file with spaces
at java.net.URI$Parser.fail (:-1)
at java.net.URI$Parser.checkChars (:-1)
at java.net.URI$Parser.parseHierarchical (:-1)
```

This is due to the URI constructor, specifically because it does not allow input strings to have spaces in them. However, valid S3 URIs can contain spaces in them.

### Expected Behavior

```kotlin
// Code
val s3Uri = s3Client.utilities().parseUri(URI("s3://test-bucket/test file with spaces"))
println(s3Uri) // S3Uri(uri=s3://test-bucket/test file with spaces, bucket=test-bucket, key=test file with spaces, isPathStyle=false, queryParams={})
```

### Current Behavior

```kotlin
// Code with S3 client from v2 SDK
val s3Uri = s3Client.utilities().parseUri(URI("s3://test-bucket/test file with spaces"))

// Exception
Caused by: java.net.URISyntaxException: Illegal character in path at index 21: s3://test-bucket/test file with spaces
at java.net.URI$Parser.fail (:-1)
at java.net.URI$Parser.checkChars (:-1)
at java.net.URI$Parser.parseHierarchical (:-1)
```

### Reproduction Steps

```kotlin
val s3Uri = s3Client.utilities().parseUri(URI("s3://test-bucket/test file with spaces"))
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS Java SDK version used

2.0

### JDK version used

8

### Operating System and version

macOS 12.6.5

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

services/s3/src/main/java/software/amazon/awssdk/services/s3/S3Utilities.java の S3Utilities.parseUri() から始め、指定された URI が bucket と key の各コンポーネントにどのように読み込まれるかを追跡します。既存の parseUri() の動作とテストを確認し、既存の URI 処理を維持したまま、エンコードされていないスペースを含む S3 URI を解析できれば issue は完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, java
領域
cloud
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。