@@ -664,15 +664,20 @@ impl MicrosoftAzureBuilder {
664664 // or the convention for the hadoop driver abfs[s]://<file_system>@<account_name>.dfs.core.windows.net/<path>
665665 if parsed. username ( ) . is_empty ( ) {
666666 self . container_name = Some ( validate ( host) ?) ;
667- } else if let Some ( a) = host. strip_suffix ( ".dfs.core.windows.net" ) {
668- self . container_name = Some ( validate ( parsed. username ( ) ) ?) ;
669- self . account_name = Some ( validate ( a) ?) ;
670- } else if let Some ( a) = host. strip_suffix ( ".dfs.fabric.microsoft.com" ) {
671- self . container_name = Some ( validate ( parsed. username ( ) ) ?) ;
672- self . account_name = Some ( validate ( a) ?) ;
673- self . use_fabric_endpoint = true . into ( ) ;
674667 } else {
675- return Err ( Error :: UrlNotRecognised { url : url. into ( ) } . into ( ) ) ;
668+ match host. split_once ( '.' ) {
669+ Some ( ( a, "dfs.core.windows.net" ) ) | Some ( ( a, "blob.core.windows.net" ) ) => {
670+ self . account_name = Some ( validate ( a) ?) ;
671+ self . container_name = Some ( validate ( parsed. username ( ) ) ?) ;
672+ }
673+ Some ( ( a, "dfs.fabric.microsoft.com" ) ) | Some ( ( a, "blob.fabric.microsoft.net" ) ) => {
674+ self . account_name = Some ( validate ( a) ?) ;
675+ self . container_name = Some ( validate ( parsed. username ( ) ) ?) ;
676+ self . use_fabric_endpoint = true . into ( ) ;
677+ }
678+ _ => return Err ( Error :: UrlNotRecognised { url : url. into ( ) } . into ( ) )
679+
680+ }
676681 }
677682 }
678683 "https" => match host. split_once ( '.' ) {
@@ -1111,6 +1116,22 @@ mod tests {
11111116 assert_eq ! ( builder. container_name, Some ( "container" . to_string( ) ) ) ;
11121117 assert ! ( !builder. use_fabric_endpoint. get( ) . unwrap( ) ) ;
11131118
1119+ let mut builder = MicrosoftAzureBuilder :: new ( ) ;
1120+ builder
1121+ . parse_url ( "az://container@account.blob.core.windows.net/path-part/file" )
1122+ . unwrap ( ) ;
1123+ assert_eq ! ( builder. account_name, Some ( "account" . to_string( ) ) ) ;
1124+ assert_eq ! ( builder. container_name, Some ( "container" . to_string( ) ) ) ;
1125+ assert ! ( !builder. use_fabric_endpoint. get( ) . unwrap( ) ) ;
1126+
1127+ let mut builder = MicrosoftAzureBuilder :: new ( ) ;
1128+ builder
1129+ . parse_url ( "az://container@account.dfs.fabric.microsoft.com/path-part/file" )
1130+ . unwrap ( ) ;
1131+ assert_eq ! ( builder. account_name, Some ( "account" . to_string( ) ) ) ;
1132+ assert_eq ! ( builder. container_name, Some ( "container" . to_string( ) ) ) ;
1133+ assert ! ( builder. use_fabric_endpoint. get( ) . unwrap( ) ) ;
1134+
11141135 let mut builder = MicrosoftAzureBuilder :: new ( ) ;
11151136 builder
11161137 . parse_url ( "abfss://file_system@account.dfs.fabric.microsoft.com/" )
0 commit comments