From 45759bd3cb6c845fbd6e74ef174ff23720967f04 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Wed, 14 Jan 2026 20:25:27 +0000 Subject: [PATCH] Fix Azure URL parsing --- src/azure/builder.rs | 6 +++--- src/parse.rs | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/azure/builder.rs b/src/azure/builder.rs index 278ffbf4..8fb9609e 100644 --- a/src/azure/builder.rs +++ b/src/azure/builder.rs @@ -670,13 +670,13 @@ impl MicrosoftAzureBuilder { self.account_name = Some(validate(a)?); self.container_name = Some(validate(parsed.username())?); } - Some((a, "dfs.fabric.microsoft.com")) | Some((a, "blob.fabric.microsoft.net")) => { + Some((a, "dfs.fabric.microsoft.com")) + | Some((a, "blob.fabric.microsoft.net")) => { self.account_name = Some(validate(a)?); self.container_name = Some(validate(parsed.username())?); self.use_fabric_endpoint = true.into(); } - _ => return Err(Error::UrlNotRecognised { url: url.into() }.into()) - + _ => return Err(Error::UrlNotRecognised { url: url.into() }.into()), } } } diff --git a/src/parse.rs b/src/parse.rs index b21a8e24..7ac31100 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -52,7 +52,7 @@ impl From for super::Error { /// - `memory:///` -> [`InMemory`] /// - `s3://bucket/path` -> [`AmazonS3`](crate::aws::AmazonS3) (also supports `s3a`) /// - `gs://bucket/path` -> [`GoogleCloudStorage`](crate::gcp::GoogleCloudStorage) -/// - `az://account/container/path` -> [`MicrosoftAzure`](crate::azure::MicrosoftAzure) (also supports `adl`, `azure`, `abfs`, `abfss`) +/// - `[az|abfs[s]]://container[@.]/path` -> [`MicrosoftAzure`](crate::azure::MicrosoftAzure) /// - `http://mydomain/path` -> [`HttpStore`](crate::http::HttpStore) /// - `https://mydomain/path` -> [`HttpStore`](crate::http::HttpStore) /// @@ -110,8 +110,9 @@ impl ObjectStoreScheme { ("memory", None) => (Self::Memory, url.path()), ("s3" | "s3a", Some(_)) => (Self::AmazonS3, url.path()), ("gs", Some(_)) => (Self::GoogleCloudStorage, url.path()), - ("az", Some(_)) => (Self::MicrosoftAzure, strip_bucket().unwrap_or_default()), - ("adl" | "azure" | "abfs" | "abfss", Some(_)) => (Self::MicrosoftAzure, url.path()), + ("az" | "adl" | "azure" | "abfs" | "abfss", Some(_)) => { + (Self::MicrosoftAzure, url.path()) + } ("http", Some(_)) => (Self::Http, url.path()), ("https", Some(host)) => { if host.ends_with("dfs.core.windows.net") @@ -299,11 +300,35 @@ mod tests { (ObjectStoreScheme::MicrosoftAzure, "path"), ), ( - "az://account/container", - (ObjectStoreScheme::MicrosoftAzure, ""), + "az://container/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "az://container@account/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "abfs://container/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "abfs://container@account/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "abfss://container/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "abfss://container@account/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), + ), + ( + "adl://container/path", + (ObjectStoreScheme::MicrosoftAzure, "path"), ), ( - "az://account/container/path", + "adl://container@account/path", (ObjectStoreScheme::MicrosoftAzure, "path"), ), (