💾 Archived View for lists.flounder.online › patches › threads › 20210322223344.6568-2-johann@qwertqw… captured on 2022-07-16 at 16:24:53. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-04-28)
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Mon, 22 Mar 2021 23:33:44 +0100
Message-Id: 20210322223344.6568-2-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
In-Reply-To: 20210322223344.6568-1-johann@qwertqwefsday.eu
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
From: Johann150 <johann@qwertqwefsday.eu>
---
src/errorpage.rs | 7 ++++---
src/main.rs | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/errorpage.rs b/src/errorpage.rs
index dbfcba7..3df280f 100644
--- 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
index 4490fb7..c78f8f1 100644
--- 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(|_| {
--
2.20.1