alamb commented on code in PR #552:
URL: 
https://github.com/apache/arrow-rs-object-store/pull/552#discussion_r2683050830


##########
src/azure/builder.rs:
##########
@@ -671,36 +673,86 @@ impl MicrosoftAzureBuilder {
                     self.container_name = Some(validate(parsed.username())?);
                     self.account_name = Some(validate(a)?);
                     self.use_fabric_endpoint = true.into();
+                } else if let Some(a) = 
host.strip_suffix(".blob.core.windows.net") {
+                    self.container_name = Some(validate(parsed.username())?);
+                    self.account_name = Some(validate(a)?);
+                } else if let Some(a) = 
host.strip_suffix(".blob.fabric.microsoft.com") {
+                    self.container_name = Some(validate(parsed.username())?);
+                    self.account_name = Some(validate(a)?);
+                    self.use_fabric_endpoint = true.into();
+                } else if let Some(a) = 
host.strip_suffix("-api.onelake.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());
                 }
             }
-            "https" => match host.split_once('.') {
-                Some((a, "dfs.core.windows.net")) | Some((a, 
"blob.core.windows.net")) => {
-                    self.account_name = Some(validate(a)?);
-                    let container = 
parsed.path_segments().unwrap().next().expect(
-                        "iterator always contains at least one string (which 
may be empty)",
-                    );
-                    if !container.is_empty() {
-                        self.container_name = Some(validate(container)?);
-                    }
+            "https" => {
+                // Regex to match WS-PL FQDN:
+                // "{workspaceid}.z??.(onelake|dfs|blob).fabric.microsoft.com"
+                static WS_PL_REGEX: OnceLock<Regex> = OnceLock::new();
+                let ws_pl_regex = WS_PL_REGEX.get_or_init(|| {
+                    Regex::new(
+                        
r"^(?P<workspaceid>[0-9a-f]{32})\.z(?P<xy>[0-9a-f]{2})\.(onelake|dfs|blob)\.fabric\.microsoft\.com$"
+                    ).unwrap()
+                });
+
+                // WS-PL Fabric endpoint
+                if let Some(captures) = ws_pl_regex.captures(host) {
+                    let workspaceid = 
captures.name("workspaceid").unwrap().as_str();
+                    let xy = captures.name("xy").unwrap().as_str();
+
+                    self.account_name = Some(format!("{workspaceid}.z{xy}"));
+                    self.container_name = Some(validate(workspaceid)?);
+                    self.use_fabric_endpoint = true.into();
+                    return Ok(());
                 }
-                Some((a, "dfs.fabric.microsoft.com")) | Some((a, 
"blob.fabric.microsoft.com")) => {
-                    self.account_name = Some(validate(a)?);
-                    // Attempt to infer the container name from the URL

Review Comment:
   why remove this comment? It seems helpful



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to