Skip to content

Commit

Permalink
fix: json in html not unescaped
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed May 29, 2023
1 parent 5895b5f commit f041378
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ futures = "0.3"
futures-retry-policies = "0.2"
handlebars = "4.2"
html2text = "0.6"
htmlescape = "0.3"
leaky-bucket = "1.0"
lol_html = "1.0"
mac_address = "1.1"
Expand Down
5 changes: 4 additions & 1 deletion core/src/preloaded_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ impl PreloadedStore {
)
.write(body.as_bytes());

Ok(serde_json::from_str(&preloaded.expect("#data-preloaded"))?)
let unescaped =
htmlescape::decode_html(&preloaded.expect("#data-preloaded")).expect("unescaped");

Ok(serde_json::from_str(&unescaped)?)
}
pub fn custom_emoji(&self, name: &str) -> Option<&str> {
self.custom_emoji.get(name).map(String::as_str)
Expand Down

0 comments on commit f041378

Please sign in to comment.