From 35d4df2cb82a7662670b74dbc0a36eab2ac7f56b Mon Sep 17 00:00:00 2001 From: Daniel Szabo Date: Fri, 3 Jun 2022 18:11:14 +0100 Subject: [PATCH] Fixed a bug where opening private pastas would crash MicroBin --- src/endpoints/pastalist.rs | 2 -- templates/pastalist.html | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/endpoints/pastalist.rs b/src/endpoints/pastalist.rs index bfe649c..876017e 100644 --- a/src/endpoints/pastalist.rs +++ b/src/endpoints/pastalist.rs @@ -23,8 +23,6 @@ pub async fn list(data: web::Data) -> HttpResponse { let mut pastas = data.pastas.lock().unwrap(); - pastas.retain(|p| !p.private); - remove_expired(&mut pastas); HttpResponse::Found().content_type("text/html").body( diff --git a/templates/pastalist.html b/templates/pastalist.html index 3b1c525..fd48207 100644 --- a/templates/pastalist.html +++ b/templates/pastalist.html @@ -35,7 +35,7 @@ {% for pasta in pastas %} - {% if pasta.pasta_type == "text" %} + {% if pasta.pasta_type == "text" && !pasta.private %} {{pasta.id_as_animals()}} @@ -87,7 +87,7 @@ {% for pasta in pastas %} - {% if pasta.pasta_type == "url" %} + {% if pasta.pasta_type == "url" && !pasta.private %} {{pasta.id_as_animals()}}