linkify URLs in plaintext emails.

This commit is contained in:
2024-02-03 11:10:51 -08:00
parent 569781b592
commit 568d83f029
4 changed files with 34 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ use memmap::MmapOptions;
use notmuch::Notmuch;
use rocket::time::Instant;
use crate::sanitize_html;
use crate::{linkify_html, sanitize_html};
pub struct QueryRoot;
@@ -347,8 +347,11 @@ impl QueryRoot {
.get_first_value("date")
.and_then(|d| mailparse::dateparse(&d).ok());
let body = match extract_body(&m)? {
Body::PlainText(PlainText { text, content_tree }) => Body::PlainText(PlainText {
text,
Body::PlainText(PlainText { text, content_tree }) => Body::Html(Html {
html: format!(
r#"<p class="view-part-text-plain">{}</p>"#,
linkify_html(&text)
),
content_tree: if debug_content_tree {
render_content_type_tree(&m)
} else {