diff --git a/crates/aws/Cargo.toml b/crates/aws/Cargo.toml index 169686c240..1d46595a1d 100644 --- a/crates/aws/Cargo.toml +++ b/crates/aws/Cargo.toml @@ -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"] } diff --git a/crates/aws/src/lib.rs b/crates/aws/src/lib.rs index 026f0e0df9..41b3b83759 100644 --- a/crates/aws/src/lib.rs +++ b/crates/aws/src/lib.rs @@ -46,7 +46,16 @@ impl LogStoreFactory for S3LogStoreFactory { location: &Url, options: &StorageOptions, ) -> DeltaResult> { - 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()) { + 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