mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit fa8a4f6e8f9beb08c17c2ff1ebf3aebdaeccd0a0
parent 4afe79413a568361385721927a64f928ed41118d
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Mon, 22 Mar 2021 23:33:44 +0100

run cargo fmt

Diffstat:
Msrc/errorpage.rs | 7++++---
Msrc/main.rs | 2+-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/errorpage.rs b/src/errorpage.rs @@ -12,17 +12,18 @@ struct ErrorTemplate { pub struct ErrorToErrorpage; #[async_trait::async_trait] -impl<State: Clone + Send + Sync + 'static> Middleware<State> for ErrorToErrorpage{ +impl<State: Clone + Send + Sync + 'static> Middleware<State> for ErrorToErrorpage { async fn handle(&self, req: Request<State>, next: Next<'_, State>) -> tide::Result { let resource = req.url().path().to_string(); let mut response = next.run(req).await; if let Some(err) = response.take_error() { let status = err.status(); - response = ErrorTemplate{ + response = ErrorTemplate { resource, status, message: err.into_inner().to_string(), - }.into(); + } + .into(); response.set_status(status); } diff --git a/src/main.rs b/src/main.rs @@ -135,7 +135,7 @@ fn repo_from_request(repo_name: &str) -> Result<Repository, tide::Error> { .into_owned(); if repo_name.contains("..") { // Prevent path traversal - return Err(tide::Error::from_str(400, "Invalid name")) + return Err(tide::Error::from_str(400, "Invalid name")); } let repo_path = Path::new(&CONFIG.projectroot).join(repo_name); Repository::open(repo_path).or_else(|_| {