Skip to content

Commit

Permalink
escape html in opengraph properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jb55 committed Dec 21, 2023
1 parent 3971be3 commit b86a552
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::net::SocketAddr;

use html_escape;
use http_body_util::Full;
use hyper::body::Bytes;
use hyper::header;
Expand Down Expand Up @@ -155,8 +156,9 @@ fn serve_note_html(
// 4: Full content

let hostname = "https://damus.io";
let abbrev_content = abbreviate(&note.note.content, 64);
let content = &note.note.content;
let abbrev_content = html_escape::encode_text(abbreviate(&note.note.content, 64));
let content = html_escape::encode_text(&note.note.content);
let profile_name = html_escape::encode_text(&note.profile.name);

write!(
data,
Expand Down Expand Up @@ -192,7 +194,7 @@ fn serve_note_html(
</body>
</html>
"#,
note.profile.name,
profile_name,
abbrev_content,
hostname,
nip19.to_bech32().unwrap(),
Expand Down

0 comments on commit b86a552

Please sign in to comment.