mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-12-19 02:54:52 +01:00
fix: slicing larger indexes explodes
This commit is contained in:
parent
7aee304b70
commit
d6b5ff42be
1 changed files with 2 additions and 2 deletions
|
@ -47,8 +47,8 @@ async fn send_suggestion(payload: Insertion, state: SafeContext) -> impl IntoRes
|
||||||
let avatar = hasher.finalize();
|
let avatar = hasher.finalize();
|
||||||
let page = GuestBookPage {
|
let page = GuestBookPage {
|
||||||
avatar: format!("{:x}", avatar),
|
avatar: format!("{:x}", avatar),
|
||||||
author: payload.author.map(|x| x[..25].to_string()), // TODO don't hardcode char limits!
|
author: payload.author.map(|x| x.chars().take(25).collect()), // TODO don't hardcode char limits!
|
||||||
contact: payload.contact.clone().map(|x| x[..50].to_string()),
|
contact: payload.contact.clone().map(|x| x.chars().take(50).collect()),
|
||||||
body: payload.body,
|
body: payload.body,
|
||||||
date: Utc::now(),
|
date: Utc::now(),
|
||||||
url: match payload.contact {
|
url: match payload.contact {
|
||||||
|
|
Loading…
Reference in a new issue