From 5d635d9e9ae466ca52d1923fafdc74487030e975 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 27 Sep 2021 15:37:14 +0300 Subject: Implemented FileStorage::delete_post --- src/database/file/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs index 9e33f0b..dff527f 100644 --- a/src/database/file/mod.rs +++ b/src/database/file/mod.rs @@ -322,7 +322,10 @@ impl Storage for FileStorage { } async fn delete_post<'a>(&self, url: &'a str) -> Result<()> { - todo!() + let path = url_to_path(&self.root_dir, url); + if let Err(e) = async_std::fs::remove_file(path).await { + Err(e.into()) + } else { Ok(()) } } async fn get_setting<'a>(&self, setting: &'a str, user: &'a str) -> Result { -- cgit 1.4.1