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

URL decode s3 key in s3:ObjectCreated #5692

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tontinton
Copy link
Contributor

When a file includes :, it gets converted to %3A, and doing GetObject fails.

@tontinton tontinton force-pushed the url-decode-s3-key-in-url branch 3 times, most recently from 4c060d0 to 4514f64 Compare February 24, 2025 08:54
Copy link
Member

@guilload guilload left a comment

Choose a reason for hiding this comment

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

This deserves a unit test. @rdettai, I'll let you take over the review.

@@ -271,6 +271,7 @@ ulid = "1.1"
username = "0.2"
utoipa = { version = "4.2", features = ["time", "ulid"] }
uuid = { version = "1.10", features = ["v4", "serde"] }
urlencoding = "2.1.3"
Copy link
Member

Choose a reason for hiding this comment

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

Please, insert between ulid and username.

Copy link
Collaborator

@rdettai rdettai Mar 31, 2025

Choose a reason for hiding this comment

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

the percent-encoding lib that is already imported also does this (I don't think a lot of people actually use the term "percent encoding", but it seems it's actually the official name of url encoding 😄 )

@@ -46,6 +46,7 @@ tokio = { workspace = true }
tracing = { workspace = true }
ulid = { workspace = true }
utoipa = { workspace = true }
urlencoding = { workspace = true }
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think r comes before t 😄

@guilload guilload requested a review from rdettai February 24, 2025 15:54
@tontinton tontinton force-pushed the url-decode-s3-key-in-url branch from 4514f64 to 2225e01 Compare February 24, 2025 19:34
@tontinton tontinton requested a review from guilload March 11, 2025 08:28
@tontinton
Copy link
Contributor Author

Hey, currently forking the project for this :)

@rdettai rdettai self-assigned this Mar 31, 2025
@rdettai
Copy link
Collaborator

rdettai commented Mar 31, 2025

I was kind of waiting for you to add that test requested by guilload... I'll take a deeper look if there are other places that might be impacted.

@rdettai
Copy link
Collaborator

rdettai commented Apr 1, 2025

@tontinton, LGTM, provided that you add a small test to ensure that url encoded keys are properly decoded and use percent-encoding instead of adding urlencoding to the list of explicit dependencies.

@tontinton
Copy link
Contributor Author

Oh crap, I've written a test but didn't push :)

@tontinton tontinton force-pushed the url-decode-s3-key-in-url branch from 2225e01 to 9778e64 Compare April 1, 2025 14:16
When a file includes `:`, it gets converted to `%3A`, and doing
`GetObject` fails.
@tontinton tontinton force-pushed the url-decode-s3-key-in-url branch from 9778e64 to 69844b0 Compare April 1, 2025 14:21
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