This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new d15b32137 feat(services/fs): add `file` as an alias scheme for `fs`
(#7075)
d15b32137 is described below
commit d15b321375d91cf9d7e2ee38d2f82ac7812d61fd
Author: userzhy <[email protected]>
AuthorDate: Sat Dec 20 18:50:40 2025 +0800
feat(services/fs): add `file` as an alias scheme for `fs` (#7075)
---
core/services/fs/src/config.rs | 8 ++++++++
core/services/fs/src/lib.rs | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/core/services/fs/src/config.rs b/core/services/fs/src/config.rs
index 56cc441e2..a5e80933f 100644
--- a/core/services/fs/src/config.rs
+++ b/core/services/fs/src/config.rs
@@ -63,4 +63,12 @@ mod tests {
let cfg = FsConfig::from_uri(&uri).unwrap();
assert_eq!(cfg.root.as_deref(), Some("/tmp/data"));
}
+
+ #[test]
+ fn from_uri_with_file_scheme() {
+ // "file" is an alias for "fs" to support standard file:// URIs
+ let uri = OperatorUri::new("file:///tmp/data", Vec::<(String,
String)>::new()).unwrap();
+ let cfg = FsConfig::from_uri(&uri).unwrap();
+ assert_eq!(cfg.root.as_deref(), Some("/tmp/data"));
+ }
}
diff --git a/core/services/fs/src/lib.rs b/core/services/fs/src/lib.rs
index 06477c9e4..2867b4923 100644
--- a/core/services/fs/src/lib.rs
+++ b/core/services/fs/src/lib.rs
@@ -33,8 +33,12 @@ pub use config::FsConfig;
/// Default scheme for fs service.
pub const FS_SCHEME: &str = "fs";
+/// Alias scheme for fs service that follows the standard URI scheme.
+pub const FILE_SCHEME: &str = "file";
#[ctor::ctor]
fn register_fs_service() {
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Fs>(FS_SCHEME);
+ // Register "file" as an alias for "fs" to support standard file:// URIs
+ opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Fs>(FILE_SCHEME);
}