Special case front page so it never gets a non-empty slug
This commit is contained in:
parent
338f8346aa
commit
01dafa7d37
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,11 @@ pub enum SlugLookup {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decide_slug(conn: &SqliteConnection, article_id: i32, prev_title: &str, title: &str, prev_slug: &str) -> Result<String, Error> {
|
fn decide_slug(conn: &SqliteConnection, article_id: i32, prev_title: &str, title: &str, prev_slug: &str) -> Result<String, Error> {
|
||||||
|
if prev_slug == "" {
|
||||||
|
// Never give a non-empty slug to the front page
|
||||||
|
return Ok(String::new());
|
||||||
|
}
|
||||||
|
|
||||||
if title == prev_title {
|
if title == prev_title {
|
||||||
return Ok(prev_slug.to_owned());
|
return Ok(prev_slug.to_owned());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue