From 0b9f2c9edb9f579296363d907e05efed25111281 Mon Sep 17 00:00:00 2001 From: J Robert Ray Date: Mon, 11 Dec 2023 17:28:15 -0800 Subject: [PATCH] Use to_address to get repository address Leverage the fact that Config contains the tag address. Signed-off-by: J Robert Ray --- crates/spfs/src/storage/fs/repository.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/spfs/src/storage/fs/repository.rs b/crates/spfs/src/storage/fs/repository.rs index 7925ef6fd..caaf9bae1 100644 --- a/crates/spfs/src/storage/fs/repository.rs +++ b/crates/spfs/src/storage/fs/repository.rs @@ -325,17 +325,15 @@ impl LocalRepository for OpenFsRepository { impl OpenFsRepository { /// The address of this repository that can be used to re-open it pub fn address(&self) -> url::Url { - let mut url = url::Url::from_directory_path(self.root()).unwrap(); - // Assuming we want runtimes to respect the prevailing tag namespace, - // this needs to be included in the address produced here, since - // spfs-enter's --runtime-storage argument comes from here. - if let Some(tag_namespace) = self.tag_namespace.as_ref() { - url.set_query(Some(&format!( - "tag_namespace={}", - tag_namespace.to_string_lossy() - ))) - }; - url + Config { + path: self.root(), + params: Params { + create: false, + lazy: false, + tag_namespace: self.tag_namespace.clone(), + }, + } + .to_address().expect("repository address is valid") } /// The filesystem root path of this repository