Escape HTML entities in notif body

This commit is contained in:
Jon Gjengset 2019-02-13 12:41:10 -05:00
parent 3904ed1025
commit f2a6149294
No known key found for this signature in database
GPG Key ID: D64AC9D67176DC71
3 changed files with 12 additions and 3 deletions

9
Cargo.lock generated
View File

@ -30,6 +30,11 @@ dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "askama_escape"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "aster"
version = "0.38.0"
@ -146,8 +151,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "buzz"
version = "1.1.2"
version = "1.1.3"
dependencies = [
"askama_escape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"imap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mailparse 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1474,6 +1480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
"checksum askama_escape 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "719b48039ffac1564f67d70162109ba9341125cee0096a540e478355b3c724a7"
"checksum aster 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c9b49e42a449c0b79d8acb91db37621de0978064dca7d3288ddcf030123e5b3"
"checksum atk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8dc233521f7bffd3042c31082ea71bd08820abf44bac938fb36591e20f76f39"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"

View File

@ -1,6 +1,6 @@
[package]
name = "buzz"
version = "1.1.2"
version = "1.1.3"
description = "A simple system tray application for notifying about unseen e-mail"
readme = "README.md"
@ -30,3 +30,4 @@ toml = "0.4.2"
xdg = "2.1.0"
notify-rust = "3.4.0"
rayon = "1.0.0"
askama_escape = "0.1"

View File

@ -1,3 +1,4 @@
extern crate askama_escape;
extern crate imap;
extern crate mailparse;
extern crate native_tls;
@ -147,7 +148,7 @@ impl<T: Read + Write + imap::extensions::idle::SetReadTimeout> Connection<T> {
println!("{}", notification);
Notification::new()
.summary(&title)
.body(&notification)
.body(&format!("{}", askama_escape::escape(&notification)))
.icon("notification-message-email")
.hint(NotificationHint::Category("email".to_owned()))
.timeout(-1)