limit size of note

This commit is contained in:
2021-05-02 14:41:08 +02:00
parent 5c95f0be42
commit 3692d0a2e6
4 changed files with 14 additions and 3 deletions

View File

@@ -41,6 +41,9 @@ async fn create(note: web::Json<Note>) -> impl Responder {
let mut n = note.into_inner();
let id = generate_id();
let bad_req = HttpResponse::BadRequest().finish();
if n.contents.chars().count() > 8192 {
return bad_req;
}
if n.views == None && n.expiration == None {
return bad_req;
}