diff --git a/object_store/src/azure/builder.rs b/object_store/src/azure/builder.rs index 905fa5216fc8..530095ff7844 100644 --- a/object_store/src/azure/builder.rs +++ b/object_store/src/azure/builder.rs @@ -474,6 +474,7 @@ impl MicrosoftAzureBuilder { /// - `azure:///` (custom) /// - `https://.dfs.core.windows.net` /// - `https://.blob.core.windows.net` + /// - `https://.blob.core.windows.net/` /// - `https://.dfs.fabric.microsoft.com` /// - `https://.dfs.fabric.microsoft.com/` /// - `https://.blob.fabric.microsoft.com` @@ -589,6 +590,9 @@ impl MicrosoftAzureBuilder { "https" => match host.split_once('.') { Some((a, "dfs.core.windows.net")) | Some((a, "blob.core.windows.net")) => { self.account_name = Some(validate(a)?); + if let Some(container) = parsed.path_segments().unwrap().next() { + self.container_name = Some(validate(container)?); + } } Some((a, "dfs.fabric.microsoft.com")) | Some((a, "blob.fabric.microsoft.com")) => { self.account_name = Some(validate(a)?); @@ -984,6 +988,14 @@ mod tests { assert_eq!(builder.account_name, Some("account".to_string())); assert!(!builder.use_fabric_endpoint.get().unwrap()); + let mut builder = MicrosoftAzureBuilder::new(); + builder + .parse_url("https://account.blob.core.windows.net/container") + .unwrap(); + assert_eq!(builder.account_name, Some("account".to_string())); + assert_eq!(builder.container_name, Some("container".to_string())); + assert!(!builder.use_fabric_endpoint.get().unwrap()); + let mut builder = MicrosoftAzureBuilder::new(); builder .parse_url("https://account.dfs.fabric.microsoft.com/")