From 5e291ca70ca2712696fa5378894e4204679a5f7d Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 27 Sep 2021 17:39:43 +0300 Subject: Fix a bug in the error middleware When an error is found, the site name passed to Storage::get_setting in the error handler is incorrect. The ASCII serialisation of the hostname should get used. --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 1c6394a..dfcfe6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,12 +94,14 @@ pub async fn get_app_with_file( media_endpoint: Option, internal_token: Option, ) -> App { + let folder = backend_uri.strip_prefix("file://").unwrap(); + let path = std::path::PathBuf::from(folder); let app = tide::with_state(ApplicationState { token_endpoint, media_endpoint, authorization_endpoint, internal_token, - storage: database::FileStorage::new(todo!()).await.unwrap(), + storage: database::FileStorage::new(path).await.unwrap(), http_client: surf::Client::new(), }); -- cgit 1.4.1