now throw 404 error page if the final number doesn't exists
parent
b7bca3e455
commit
a8094b5411
|
@ -85,7 +85,7 @@ fn show_post(title: String) -> Template {
|
||||||
let mut context = get_context();
|
let mut context = get_context();
|
||||||
|
|
||||||
let title_splited: Vec<&str> = title.split('-').collect();
|
let title_splited: Vec<&str> = title.split('-').collect();
|
||||||
let id = title_splited.last().unwrap().parse().unwrap();
|
let id = title_splited.last().unwrap().parse().unwrap_or_else(|_| -1);
|
||||||
|
|
||||||
match get_post(id) {
|
match get_post(id) {
|
||||||
Ok(mut post) => {
|
Ok(mut post) => {
|
||||||
|
|
Loading…
Reference in New Issue