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

fix(rust): special characters in s3 paths #2308

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/aws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ uuid = { workspace = true, features = ["serde", "v4"] }
url = { workspace = true }
backoff = { version = "0.4", features = [ "tokio" ] }
hyper-tls = { version = "0.5", optional = true }
urlencoding = "2.1.3"

[dev-dependencies]
deltalake-core = { path = "../core", features = ["datafusion"] }
Expand Down
11 changes: 10 additions & 1 deletion crates/aws/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ impl LogStoreFactory for S3LogStoreFactory {
location: &Url,
options: &StorageOptions,
) -> DeltaResult<Arc<dyn LogStore>> {
let store = url_prefix_handler(store, Path::parse(location.path())?)?;
// Decode this path, as this prefix is passed into an S3 API that does not expect a URL-encoded path
let path_decoded = match urlencoding::decode(location.path()) {
Copy link
Member

Choose a reason for hiding this comment

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

This line would benefit from a comment as to what this decoding does/why it exists

Copy link
Author

Choose a reason for hiding this comment

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

Added

Ok(res) => res.into_owned(),
Err(e) => {
// Default back to prefix as is
location.path().to_string()
}
};

let store = url_prefix_handler(store, Path::parse(path_decoded)?)?;

if options
.0
Expand Down
Loading