aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml5
-rw-r--r--src/gemini_to_html.rs5
2 files changed, 7 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d741b16..f86b42a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "september"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Fuwn <[email protected]>"]
edition = "2021"
description = "A simple and efficient Gemini-to-HTTP proxy."
@@ -34,6 +34,9 @@ log = "0.4.16"
# Environment Variables
dotenv = "0.15.0"
+# HTML Entity-encode Text
+htmlescape = "0.3.1"
+
[build-dependencies]
# Environment Variables
vergen = "7.0.0"
diff --git a/src/gemini_to_html.rs b/src/gemini_to_html.rs
index 870910b..845c568 100644
--- a/src/gemini_to_html.rs
+++ b/src/gemini_to_html.rs
@@ -42,8 +42,9 @@ pub fn gemini_to_html(
url: &Url,
is_proxy: bool,
) -> (String, String) {
- let ast_tree =
- germ::ast::Ast::from_string(&String::from_utf8_lossy(&response.data));
+ let ast_tree = germ::ast::Ast::from_string(&htmlescape::encode_minimal(
+ &String::from_utf8_lossy(&response.data),
+ ));
let ast = ast_tree.inner();
let mut html = String::new();
let mut title = "".to_string();