From 415e4e120ee8903e49d575f3a7bef6b3d728ab56 Mon Sep 17 00:00:00 2001 From: meeg_leeto Date: Sat, 14 May 2022 23:47:28 +0100 Subject: [PATCH] fix: hotfix: log needs to happen after filter rejection fallthrough --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3710623..df8e300 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "lonk" -version = "1.0.0" +version = "1.0.1" dependencies = [ "argh", "async-object-pool", diff --git a/Cargo.toml b/Cargo.toml index 5bb1dae..5b1f7fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lonk" -version = "1.0.0" +version = "1.0.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 671f5a8..345f97c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1218,8 +1218,7 @@ async fn serve() { .unwrap(), Err((status, message)) => Response::builder().status(status).body(message).unwrap(), } - }) - .with(log); + }); // GET /l/:Slug let link = warp::path("l") @@ -1233,19 +1232,17 @@ async fn serve() { .unwrap(), Err((status, message)) => Response::builder().status(status).body(message).unwrap(), } - }) - .with(log); + }); // GET / // This should be the last thing matched, so that anything that doesn't // match another filter will try to match a file. let homepage = warp::get() - .and(config.serve_rules.dir.to_filter()) - .with(log); + .and(config.serve_rules.dir.to_filter()); let get_routes = warp::get().and(link.or(homepage)); let post_routes = warp::post().and(shorten); - let routes = get_routes.or(post_routes); + let routes = get_routes.or(post_routes).with(log); eprintln!( "Now serving lonk at IP {}, port {}!",