From d6064461e9ef4da518eea684e6dea7b8fcddc470 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 21 Feb 2022 20:48:44 +0300 Subject: database/file: use Authority instead of origin for directories --- src/database/file/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs index 6cbe3c6..da8a06a 100644 --- a/src/database/file/mod.rs +++ b/src/database/file/mod.rs @@ -97,9 +97,9 @@ fn url_to_path(root: &Path, url: &str) -> PathBuf { } fn url_to_relative_path(url: &str) -> relative_path::RelativePathBuf { - let url = http_types::Url::parse(url).expect("Couldn't parse a URL"); + let url = warp::http::Uri::try_from(url).expect("Couldn't parse a URL"); let mut path = relative_path::RelativePathBuf::new(); - path.push(url.origin().ascii_serialization() + &url.path().to_string() + ".json"); + path.push(url.authority().unwrap().to_string() + &url.path().to_string() + ".json"); path } @@ -375,7 +375,7 @@ impl Storage for FileStorage { println!("Adding to channel list..."); // Add the h-feed to the channel list let mut path = relative_path::RelativePathBuf::new(); - path.push(user); + path.push(warp::http::Uri::try_from(user.to_string()).unwrap().authority().unwrap().to_string()); path.push("channels"); let path = path.to_path(&self.root_dir); @@ -456,7 +456,7 @@ impl Storage for FileStorage { async fn get_channels<'a>(&self, user: &'a str) -> Result> { let mut path = relative_path::RelativePathBuf::new(); - path.push(user.to_string()); + path.push(warp::http::Uri::try_from(user.to_string()).unwrap().authority().unwrap().to_string()); path.push("channels"); let path = path.to_path(&self.root_dir); -- cgit 1.4.1