From d5745da9ead2159368b587cdf02f46a085d5a484 Mon Sep 17 00:00:00 2001 From: Robert Pack Date: Wed, 21 Dec 2022 12:19:52 +0100 Subject: [PATCH] fix: azure sas key url encoding --- rust/src/builder/azure.rs | 4 ++++ rust/src/builder/mod.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/rust/src/builder/azure.rs b/rust/src/builder/azure.rs index 448f8379ad..cad578832c 100644 --- a/rust/src/builder/azure.rs +++ b/rust/src/builder/azure.rs @@ -5,6 +5,7 @@ use crate::DeltaResult; use object_store::azure::MicrosoftAzureBuilder; use once_cell::sync::Lazy; +use percent_encoding::percent_decode_str; #[derive(PartialEq, Eq)] enum AzureConfigKey { @@ -220,6 +221,9 @@ fn parse_boolean(term: &str) -> Option { } fn split_sas(sas: &str) -> Result, BuilderError> { + let sas = percent_decode_str(sas) + .decode_utf8() + .map_err(|err| BuilderError::Decode(err.to_string()))?; let kv_str_pairs = sas .trim_start_matches('?') .split('&') diff --git a/rust/src/builder/mod.rs b/rust/src/builder/mod.rs index 05f64efe65..4184f0d3dc 100644 --- a/rust/src/builder/mod.rs +++ b/rust/src/builder/mod.rs @@ -37,6 +37,8 @@ enum BuilderError { Required(String), #[error("Failed to find valid credential.")] MissingCredential, + #[error("Failed to decode sas key. {0}")] + Decode(String), } impl From for DeltaTableError {