This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git


The following commit(s) were added to refs/heads/main by this push:
     new 1cf4925  feat (azure): support for '.blob.core.windows.net' in 
'{az,abfs,abfss}://' (#431)
1cf4925 is described below

commit 1cf4925e51f678075d785bba198ad408644bf73a
Author: Vladislav Wohlrath <[email protected]>
AuthorDate: Mon Jan 12 17:13:33 2026 +0100

    feat (azure): support for '.blob.core.windows.net' in '{az,abfs,abfss}://' 
(#431)
    
    Co-authored-by: Vladislav Wohlrath <[email protected]>
---
 src/azure/builder.rs | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/azure/builder.rs b/src/azure/builder.rs
index e824217..278ffbf 100644
--- a/src/azure/builder.rs
+++ b/src/azure/builder.rs
@@ -664,15 +664,20 @@ impl MicrosoftAzureBuilder {
                 // or the convention for the hadoop driver 
abfs[s]://<file_system>@<account_name>.dfs.core.windows.net/<path>
                 if parsed.username().is_empty() {
                     self.container_name = Some(validate(host)?);
-                } else if let Some(a) = 
host.strip_suffix(".dfs.core.windows.net") {
-                    self.container_name = Some(validate(parsed.username())?);
-                    self.account_name = Some(validate(a)?);
-                } else if let Some(a) = 
host.strip_suffix(".dfs.fabric.microsoft.com") {
-                    self.container_name = Some(validate(parsed.username())?);
-                    self.account_name = Some(validate(a)?);
-                    self.use_fabric_endpoint = true.into();
                 } else {
-                    return Err(Error::UrlNotRecognised { url: url.into() 
}.into());
+                    match host.split_once('.') {
+                        Some((a, "dfs.core.windows.net")) | Some((a, 
"blob.core.windows.net")) => {
+                            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")) => {
+                            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())
+
+                    }
                 }
             }
             "https" => match host.split_once('.') {
@@ -1111,6 +1116,22 @@ mod tests {
         assert_eq!(builder.container_name, Some("container".to_string()));
         assert!(!builder.use_fabric_endpoint.get().unwrap());
 
+        let mut builder = MicrosoftAzureBuilder::new();
+        builder
+            
.parse_url("az://[email protected]/path-part/file")
+            .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("az://[email protected]/path-part/file")
+            .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("abfss://[email protected]/")

Reply via email to