mygit

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

commit 85efbc65c45e287454f0d3eb831984ab378f2e50
parent 246834526b11bfcefa6ecfe9225d68f81cdf62d6
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Thu, 22 Jul 2021 09:53:55 +0200

format sourcecode

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

diff --git a/src/errorpage.rs b/src/errorpage.rs @@ -27,13 +27,15 @@ impl<State: Clone + Send + Sync + 'static> Middleware<State> for ErrorToErrorpag } else { let message = match status { // don't expose 500 error - StatusCode::InternalServerError if !cfg!(debug_assertions) => "Internal Server Error".to_owned(), + StatusCode::InternalServerError if !cfg!(debug_assertions) => { + "Internal Server Error".to_owned() + } _ => err.into_inner().to_string(), }; response = ErrorTemplate { resource, status, - message: message + message, } .into(); response.set_status(status); diff --git a/src/main.rs b/src/main.rs @@ -173,7 +173,9 @@ fn repo_from_request(repo_name: &str) -> Result<Repository, tide::Error> { .decode_utf8_lossy() .into_owned(); - let repo_path = Path::new(&CONFIG.projectroot).join(repo_name).canonicalize()?; + let repo_path = Path::new(&CONFIG.projectroot) + .join(repo_name) + .canonicalize()?; // prevent path traversal if !repo_path.starts_with(&CONFIG.projectroot) {