Skip to content

Commit

Permalink
fix(storage): fix reads with "./" in object names [XML] (#8017)
Browse files Browse the repository at this point in the history
Previously, XML reads failed when the object had "./" in the name. This fixes the encoding for such a case.
  • Loading branch information
BrennaEpp authored Jun 1, 2023
1 parent b119cd0 commit 6b7b21f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions storage/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,10 @@ func (c *httpStorageClient) NewRangeReader(ctx context.Context, params *newRange

func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRangeReaderParams, s *settings) (r *Reader, err error) {
u := &url.URL{
Scheme: c.scheme,
Host: c.readHost,
Path: fmt.Sprintf("/%s/%s", params.bucket, params.object),
Scheme: c.scheme,
Host: c.readHost,
Path: fmt.Sprintf("/%s/%s", params.bucket, params.object),
RawPath: fmt.Sprintf("/%s/%s", params.bucket, url.PathEscape(params.object)),
}
verb := "GET"
if params.length == 0 {
Expand Down
3 changes: 2 additions & 1 deletion storage/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4002,7 +4002,8 @@ func TestIntegration_Reader(t *testing.T) {
"obj2",
"obj/with/slashes",
"obj/",
// "./obj", // does not work with XML
"./obj",
"!#$&'()*+,/:;=,?@,[] and spaces",
}
contents := make(map[string][]byte)

Expand Down

0 comments on commit 6b7b21f

Please sign in to comment.