aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml7
-rw-r--r--src/gemini_to_html.rs5
2 files changed, 8 insertions, 4 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d741b16..165d0c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,8 +2,8 @@
[package]
name = "september"
-version = "0.2.0"
-authors = ["Fuwn <[email protected]>"]
+version = "0.2.1"
+authors = ["Fuwn <[email protected]>"]
edition = "2021"
description = "A simple and efficient Gemini-to-HTTP proxy."
readme = "README.md"
@@ -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();