Skip to content

Commit 45759bd

Browse files
committed
Fix Azure URL parsing
1 parent 1cf4925 commit 45759bd

2 files changed

Lines changed: 34 additions & 9 deletions

File tree

src/azure/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,13 @@ impl MicrosoftAzureBuilder {
670670
self.account_name = Some(validate(a)?);
671671
self.container_name = Some(validate(parsed.username())?);
672672
}
673-
Some((a, "dfs.fabric.microsoft.com")) | Some((a, "blob.fabric.microsoft.net")) => {
673+
Some((a, "dfs.fabric.microsoft.com"))
674+
| Some((a, "blob.fabric.microsoft.net")) => {
674675
self.account_name = Some(validate(a)?);
675676
self.container_name = Some(validate(parsed.username())?);
676677
self.use_fabric_endpoint = true.into();
677678
}
678-
_ => return Err(Error::UrlNotRecognised { url: url.into() }.into())
679-
679+
_ => return Err(Error::UrlNotRecognised { url: url.into() }.into()),
680680
}
681681
}
682682
}

src/parse.rs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl From<Error> for super::Error {
5252
/// - `memory:///` -> [`InMemory`]
5353
/// - `s3://bucket/path` -> [`AmazonS3`](crate::aws::AmazonS3) (also supports `s3a`)
5454
/// - `gs://bucket/path` -> [`GoogleCloudStorage`](crate::gcp::GoogleCloudStorage)
55-
/// - `az://account/container/path` -> [`MicrosoftAzure`](crate::azure::MicrosoftAzure) (also supports `adl`, `azure`, `abfs`, `abfss`)
55+
/// - `[az|abfs[s]]://container[@<account>.<host>]/path` -> [`MicrosoftAzure`](crate::azure::MicrosoftAzure)
5656
/// - `http://mydomain/path` -> [`HttpStore`](crate::http::HttpStore)
5757
/// - `https://mydomain/path` -> [`HttpStore`](crate::http::HttpStore)
5858
///
@@ -110,8 +110,9 @@ impl ObjectStoreScheme {
110110
("memory", None) => (Self::Memory, url.path()),
111111
("s3" | "s3a", Some(_)) => (Self::AmazonS3, url.path()),
112112
("gs", Some(_)) => (Self::GoogleCloudStorage, url.path()),
113-
("az", Some(_)) => (Self::MicrosoftAzure, strip_bucket().unwrap_or_default()),
114-
("adl" | "azure" | "abfs" | "abfss", Some(_)) => (Self::MicrosoftAzure, url.path()),
113+
("az" | "adl" | "azure" | "abfs" | "abfss", Some(_)) => {
114+
(Self::MicrosoftAzure, url.path())
115+
}
115116
("http", Some(_)) => (Self::Http, url.path()),
116117
("https", Some(host)) => {
117118
if host.ends_with("dfs.core.windows.net")
@@ -299,11 +300,35 @@ mod tests {
299300
(ObjectStoreScheme::MicrosoftAzure, "path"),
300301
),
301302
(
302-
"az://account/container",
303-
(ObjectStoreScheme::MicrosoftAzure, ""),
303+
"az://container/path",
304+
(ObjectStoreScheme::MicrosoftAzure, "path"),
305+
),
306+
(
307+
"az://container@account/path",
308+
(ObjectStoreScheme::MicrosoftAzure, "path"),
309+
),
310+
(
311+
"abfs://container/path",
312+
(ObjectStoreScheme::MicrosoftAzure, "path"),
313+
),
314+
(
315+
"abfs://container@account/path",
316+
(ObjectStoreScheme::MicrosoftAzure, "path"),
317+
),
318+
(
319+
"abfss://container/path",
320+
(ObjectStoreScheme::MicrosoftAzure, "path"),
321+
),
322+
(
323+
"abfss://container@account/path",
324+
(ObjectStoreScheme::MicrosoftAzure, "path"),
325+
),
326+
(
327+
"adl://container/path",
328+
(ObjectStoreScheme::MicrosoftAzure, "path"),
304329
),
305330
(
306-
"az://account/container/path",
331+
"adl://container@account/path",
307332
(ObjectStoreScheme::MicrosoftAzure, "path"),
308333
),
309334
(

0 commit comments

Comments
 (0)