From 77bc2f9b4110eb90782cf9606ef3554e66fbd4ed Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Tue, 14 Mar 2023 10:06:08 +0100 Subject: [PATCH] Fix content type --- src/views.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views.rs b/src/views.rs index f343552..f21b1e6 100644 --- a/src/views.rs +++ b/src/views.rs @@ -12,15 +12,15 @@ use crate::language::Language; use crate::FRONTEND_DIR; #[get("/")] -pub fn frontend() -> content::Html { +pub fn frontend() -> content::RawHtml { match fs::read_to_string(&format!("{}/{}", FRONTEND_DIR, "index.html")) { - Ok(file) => content::Html(file), - Err(_) => content::Html(String::from("

No web frontend installed.

")) + Ok(file) => content::RawHtml(file), + Err(_) => content::RawHtml(String::from("

No web frontend installed.

")) } } #[get("/langs//words/")] -pub fn get_entries(db: &State, lang: &str, word: &str) -> status::Custom> { +pub fn get_entries(db: &State, lang: &str, word: &str) -> status::Custom> { let conn = db.connect(); let mut statement = conn.prepare(&format!( @@ -46,7 +46,7 @@ pub fn get_entries(db: &State, lang: &str, word: &str) -> status::Custom } words.push(']'); - status::Custom(Status::Ok, content::Json(words)) + status::Custom(Status::Ok, content::RawJson(words)) } #[get("/langs//words?&&")]