mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
Return input if decode_entities() encounters error
This commit is contained in:
parent
a6fb72780a
commit
9151bfb53e
1 changed files with 2 additions and 3 deletions
|
@ -138,10 +138,9 @@ pub fn strip_html_preserving_entities(html: &str) -> Cow<str> {
|
||||||
pub fn decode_entities(html: &str) -> Cow<str> {
|
pub fn decode_entities(html: &str) -> Cow<str> {
|
||||||
if html.contains('&') {
|
if html.contains('&') {
|
||||||
match htmlescape::decode_html(html) {
|
match htmlescape::decode_html(html) {
|
||||||
Ok(text) => text.replace('\u{a0}', " "),
|
Ok(text) => text.replace('\u{a0}', " ").into(),
|
||||||
Err(e) => format!("{:?}", e),
|
Err(_) => html.into(),
|
||||||
}
|
}
|
||||||
.into()
|
|
||||||
} else {
|
} else {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
html.into()
|
html.into()
|
||||||
|
|
Loading…
Reference in a new issue