Quick patch:

- Changed 302 responses to 200 where needed
- Fixed a bug where expiring pastas cause MicroBin to crahs
- Fixed a bug where water.css didn't have the correct MIME type
- Fixed a bug where missing doctype declaration caused styling issues in Firefox
This commit is contained in:
Daniel Szabo 2022-06-04 21:50:34 +01:00
parent 35d4df2cb8
commit be3ac27920
10 changed files with 32 additions and 25 deletions

View file

@ -27,7 +27,7 @@ pub async fn getpasta(data: web::Data<AppState>, id: web::Path<String>) -> HttpR
for pasta in pastas.iter() {
if pasta.id == id {
return HttpResponse::Found().content_type("text/html").body(
return HttpResponse::Ok().content_type("text/html").body(
PastaTemplate {
pasta: &pasta,
args: &ARGS,
@ -38,7 +38,7 @@ pub async fn getpasta(data: web::Data<AppState>, id: web::Path<String>) -> HttpR
}
}
HttpResponse::Found()
HttpResponse::Ok()
.content_type("text/html")
.body(ErrorTemplate { args: &ARGS }.render().unwrap())
}
@ -54,18 +54,18 @@ pub async fn redirecturl(data: web::Data<AppState>, id: web::Path<String>) -> Ht
for pasta in pastas.iter() {
if pasta.id == id {
if pasta.pasta_type == "url" {
return HttpResponse::Found()
return HttpResponse::Ok()
.append_header(("Location", String::from(&pasta.content)))
.finish();
} else {
return HttpResponse::Found()
return HttpResponse::Ok()
.content_type("text/html")
.body(ErrorTemplate { args: &ARGS }.render().unwrap());
}
}
}
HttpResponse::Found()
HttpResponse::Ok()
.content_type("text/html")
.body(ErrorTemplate { args: &ARGS }.render().unwrap())
}