diff options
author | Vika <vika@fireburn.ru> | 2022-02-21 20:48:44 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-02-21 20:48:44 +0300 |
commit | d6064461e9ef4da518eea684e6dea7b8fcddc470 (patch) | |
tree | 15c14c5e51bb4152d6b579e5c2687552f1f53e66 | |
parent | 2e54681af0bc76ed22ce43f8126a029e600ece93 (diff) | |
download | kittybox-d6064461e9ef4da518eea684e6dea7b8fcddc470.tar.zst |
database/file: use Authority instead of origin for directories
-rw-r--r-- | src/database/file/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<Vec<super::MicropubChannel>> { 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); |