Disallow blog name which yould result in empty blog name

fix #63
This commit is contained in:
Trinity Pointard 2018-06-19 22:34:59 +02:00
parent 84d58b253d
commit db248701b9
1 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,9 @@ struct NewBlogForm {
fn create(conn: DbConn, data: Form<NewBlogForm>, 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 {