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

Percent decode the list files when parsing response #93

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

irevoire
Copy link
Contributor

@irevoire irevoire commented Oct 12, 2023

Hello, while trying out the ListObjectsV2::parse_response command I noticed that we were not percent decoding the keys as documented here: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_RequestSyntax

I had no issue with minio as I don't use any strange characters. But the Digital Ocean S3 implementation does percent-encode the / character, which completely broke my code.
I updated my lib, but I think it should be handled by rusty_s3 directly, personally 🤔

What do you think?

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #93 (8308fc9) into main (b31692f) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   90.23%   90.31%   +0.07%     
==========================================
  Files          29       29              
  Lines        1372     1383      +11     
==========================================
+ Hits         1238     1249      +11     
  Misses        134      134              
Files Coverage Δ
src/actions/list_objects_v2.rs 88.99% <100.00%> (+1.49%) ⬆️

... and 2 files with indirect coverage changes

Copy link
Owner

@paolobarbolini paolobarbolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I had completely missed the fact they are encoding the keys.

// #[serde(rename = "EncodingType")]
// encoding_type: String,
#[serde(rename = "EncodingType")]
encoding_type: String,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wandering whether this should be an enum or not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like an Option<String>?

Since there is an official S3 specification, as far as I know, I have no idea.
What I can say is that DO, minio, and was all return the encoding_type set to url. But maybe some other providers don't.

I would say we keep it like that until someone gives us an implementation that doesn't work like that personally 😅

src/actions/list_objects_v2.rs Outdated Show resolved Hide resolved
@irevoire
Copy link
Contributor Author

Hey, sorry I was on vacation last week.
I applied both your comment and @Kerollmops review comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants