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

xuanwo pushed a commit to branch registry-more
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 0c00e7d85e779a0ed512e751044ecd641f5cbbd8
Author: Xuanwo <[email protected]>
AuthorDate: Wed Oct 1 19:31:17 2025 +0800

    Fix tests
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/services/azblob/backend.rs |  2 +-
 core/src/services/fs/backend.rs     | 21 +++++++--------------
 core/src/types/operator/uri.rs      |  2 +-
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/core/src/services/azblob/backend.rs 
b/core/src/services/azblob/backend.rs
index 812b657a8..7e995dc67 100644
--- a/core/src/services/azblob/backend.rs
+++ b/core/src/services/azblob/backend.rs
@@ -629,7 +629,7 @@ mod tests {
     #[test]
     fn from_uri_with_path_container() {
         let uri = OperatorUri::new(
-            "azblob:///my-container/nested/root".parse().unwrap(),
+            "azblob://my-container/nested/root".parse().unwrap(),
             Vec::<(String, String)>::new(),
         )
         .unwrap();
diff --git a/core/src/services/fs/backend.rs b/core/src/services/fs/backend.rs
index a5ddac1ff..0b616bc7d 100644
--- a/core/src/services/fs/backend.rs
+++ b/core/src/services/fs/backend.rs
@@ -36,20 +36,13 @@ impl Configurator for FsConfig {
     fn from_uri(uri: &OperatorUri) -> Result<Self> {
         let mut map = uri.options().clone();
 
-        if map.contains_key("root") {
-            return Self::from_iter(map);
-        }
-
-        if let Some(root) = uri.root() {
-            let value = if uri.name().is_none() {
-                if root.starts_with('/') {
-                    root.to_string()
-                } else {
-                    format!("/{}", root)
-                }
-            } else {
-                root.to_string()
-            };
+        if let Some(value) = match (uri.name(), uri.root()) {
+            (Some(name), Some(rest)) if !rest.is_empty() => 
Some(format!("/{}/{}", name, rest)),
+            (Some(name), _) => Some(format!("/{}", name)),
+            (None, Some(rest)) if !rest.is_empty() => Some(format!("/{}", 
rest)),
+            (None, Some(rest)) => Some(rest.to_string()),
+            _ => None,
+        } {
             map.insert("root".to_string(), value);
         }
 
diff --git a/core/src/types/operator/uri.rs b/core/src/types/operator/uri.rs
index 823db7dbe..7cfc7900c 100644
--- a/core/src/types/operator/uri.rs
+++ b/core/src/types/operator/uri.rs
@@ -42,7 +42,7 @@ impl OperatorUri {
             .ok_or_else(|| Error::new(ErrorKind::ConfigInvalid, "uri scheme is 
required"))?
             .to_ascii_lowercase();
 
-        let mut options = HashMap::new();
+        let mut options = HashMap::<String, String>::new();
 
         if let Some(query) = uri.query() {
             for pair in query.split('&') {

Reply via email to