aboutsummaryrefslogtreecommitdiffstats
path: root/askama_escape/src
diff options
context:
space:
mode:
authorLibravatar Ciprian Dorin Craciun <ciprian@volution.ro>2020-05-24 20:45:37 +0300
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-05-24 20:06:44 +0200
commitb5ecf9bd871462463365c2de193c3c5dc1e0bb50 (patch)
tree6dedfcc51f07087894192192140633912b0356bd /askama_escape/src
parentb5a6a34bdd642ea2d89f984fb50f4371365c9b93 (diff)
downloadaskama-b5ecf9bd871462463365c2de193c3c5dc1e0bb50.tar.gz
askama-b5ecf9bd871462463365c2de193c3c5dc1e0bb50.tar.bz2
askama-b5ecf9bd871462463365c2de193c3c5dc1e0bb50.zip
Update `EscapeWriter` HTML implementation to not output empty strings
Diffstat (limited to 'askama_escape/src')
-rw-r--r--askama_escape/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
index 2771507..0222277 100644
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -129,7 +129,11 @@ impl Escaper for Html {
}
}
}
- fmt.write_str(unsafe { str::from_utf8_unchecked(&bytes[start..]) })
+ if start < bytes.len() {
+ fmt.write_str(unsafe { str::from_utf8_unchecked(&bytes[start..]) })
+ } else {
+ Ok(())
+ }
}
}