Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list_objects is response is stripping whitespace from the object keys #153

Closed
mdaffin opened this issue Jul 16, 2021 · 1 comment · Fixed by #168
Closed

list_objects is response is stripping whitespace from the object keys #153

mdaffin opened this issue Jul 16, 2021 · 1 comment · Fixed by #168
Assignees
Labels
bug This issue is a bug.

Comments

@mdaffin
Copy link

mdaffin commented Jul 16, 2021

Bug Report

Version

├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
├── aws-sdk-s3 v0.0.10-alpha (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── aws-endpoint v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   └── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── aws-http v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── aws-hyper v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── aws-endpoint v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── aws-http v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── aws-sig-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   │   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── protocol-test-helpers v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   ├── smithy-client v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   │   ├── protocol-test-helpers v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   │   ├── smithy-http-tower v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
│   │   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── smithy-http-tower v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── aws-sig-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)
│   └── smithy-xml v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57)
├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.10-alpha#abe0ae57) (*)

Platform

Linux desktop-01 5.12.13-arch1-1 #1 SMP PREEMPT Wed, 23 Jun 2021 16:19:29 +0000 x86_64 GNU/Linux

AWS Services

S3

Description

When listing a objects that begin or end in a white space the output strips that whitespace from the objects key in the response leading to the wrong key being used in the application.

        client.create_bucket().bucket("foo").send().await.unwrap();
        client.put_object().bucket("foo").key(" a ").send().await.unwrap();
        client
            .list_objects()
            .bucket("foo")
            .send()
            .await
            .unwrap()
            .contents
            .unwrap()
            .iter()
            .filter_map(|o| o.key.as_ref())
            .for_each(|k| println!("{:?}", k));

Produces: "a"

Where I expected it to give " a ".

Logs when testing against a temp minio instance:

[2021-07-16T01:29:48Z TRACE smithy_http_tower::dispatch] request=Request { method: PUT, uri: http://localhost:8080/foo, version: HTTP/1.1, headers: {"content-type": "application/xml", "content-length": "0", "host": "localhost", "user-agent": "aws-sdk-rust/0.1.0 os/linux lang/rust/1.53.0", "x-amz-user-agent": "aws-sdk-rust/0.1.0 api/s3/0.0.10-alpha os/linux lang/rust/1.53.0", "authorization": Sensitive, "x-amz-date": "20210716T012948Z", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, body: SdkBody { inner: Once(Some(b"")), retryable: true } }
[2021-07-16T01:29:48Z TRACE smithy_http::middleware] response=Response { status: 200, version: HTTP/1.1, headers: {"accept-ranges": "bytes", "content-length": "0", "content-security-policy": "block-all-mixed-content", "location": "/foo", "server": "MinIO", "vary": "Origin", "x-amz-request-id": "169221434ED2E935", "x-xss-protection": "1; mode=block", "date": "Fri, 16 Jul 2021 01:29:48 GMT"}, body: b"" }
[2021-07-16T01:29:48Z TRACE smithy_http_tower::dispatch] request=Request { method: PUT, uri: http://localhost:8080/foo/%20a%20?x-id=PutObject, version: HTTP/1.1, headers: {"content-type": "application/octet-stream", "content-length": "0", "host": "localhost", "user-agent": "aws-sdk-rust/0.1.0 os/linux lang/rust/1.53.0", "x-amz-user-agent": "aws-sdk-rust/0.1.0 api/s3/0.0.10-alpha os/linux lang/rust/1.53.0", "authorization": Sensitive, "x-amz-date": "20210716T012948Z", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, body: SdkBody { inner: Once(Some(b"")), retryable: true } }
[2021-07-16T01:29:48Z TRACE smithy_http::middleware] response=Response { status: 200, version: HTTP/1.1, headers: {"accept-ranges": "bytes", "content-length": "0", "content-security-policy": "block-all-mixed-content", "etag": "\"d41d8cd98f00b204e9800998ecf8427e\"", "server": "MinIO", "vary": "Origin", "x-amz-request-id": "169221434F0E9ADC", "x-xss-protection": "1; mode=block", "date": "Fri, 16 Jul 2021 01:29:48 GMT"}, body: b"" }
[2021-07-16T01:29:48Z TRACE smithy_http_tower::dispatch] request=Request { method: GET, uri: http://localhost:8080/foo, version: HTTP/1.1, headers: {"content-type": "application/xml", "content-length": "0", "host": "localhost", "user-agent": "aws-sdk-rust/0.1.0 os/linux lang/rust/1.53.0", "x-amz-user-agent": "aws-sdk-rust/0.1.0 api/s3/0.0.10-alpha os/linux lang/rust/1.53.0", "authorization": Sensitive, "x-amz-date": "20210716T012948Z", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, body: SdkBody { inner: Once(Some(b"")), retryable: true } }
[2021-07-16T01:29:48Z TRACE smithy_http::middleware] response=Response { status: 200, version: HTTP/1.1, headers: {"accept-ranges": "bytes", "content-length": "566", "content-security-policy": "block-all-mixed-content", "content-type": "application/xml", "server": "MinIO", "vary": "Origin", "x-amz-request-id": "16922143505BC807", "x-xss-protection": "1; mode=block", "date": "Fri, 16 Jul 2021 01:29:48 GMT"}, body: b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ListBucketResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Name>foo</Name><Prefix></Prefix><Marker></Marker><MaxKeys>4500</MaxKeys><Delimiter></Delimiter><IsTruncated>false</IsTruncated><Contents><Key> a </Key><LastModified>2021-07-16T01:29:48.405Z</LastModified><ETag>&#34;d41d8cd98f00b204e9800998ecf8427e&#34;</ETag><Size>0</Size><Owner><ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID><DisplayName>minio</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>" }
@rcoh
Copy link
Contributor

rcoh commented Jul 16, 2021

thanks for the report! I verified that S3 behaves the same way and I'm working on a fix

@rcoh rcoh self-assigned this Jul 16, 2021
@rcoh rcoh added the bug This issue is a bug. label Jul 16, 2021
@rcoh rcoh added this to We're Working On It in SDK for Rust Public Roadmap Jul 16, 2021
@rcoh rcoh moved this from We're Working On It to Coming Soon (slated for inclusion in next release) in SDK for Rust Public Roadmap Jul 27, 2021
@rcoh rcoh closed this as completed in #168 Jul 28, 2021
SDK for Rust Public Roadmap automation moved this from Coming Soon (slated for inclusion in next release) to Just Shipped Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants