From db248701b9b5d1f8f1187f421e02e409041bb991 Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Tue, 19 Jun 2018 22:34:59 +0200 Subject: [PATCH] Disallow blog name which yould result in empty blog name fix #63 --- src/routes/blogs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 118dac80..880872ad 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -58,7 +58,9 @@ struct NewBlogForm { fn create(conn: DbConn, data: Form, user: User) -> Redirect { let form = data.get(); let slug = utils::make_actor_id(form.title.to_string()); - + if slug.len() == 0 { + return Redirect::to("/blogs/new") + } if Blog::find_local(&*conn, slug.clone()).is_some() { Redirect::to(uri!(new)) } else {