Rejectd illegal characters from blog name
This commit is contained in:
parent
2d10ddb9fa
commit
9776374d17
@ -82,6 +82,8 @@ fn valid_slug(title: &str) -> Result<(), ValidationError> {
|
|||||||
let slug = Blog::slug(title);
|
let slug = Blog::slug(title);
|
||||||
if slug.is_empty() {
|
if slug.is_empty() {
|
||||||
Err(ValidationError::new("empty_slug"))
|
Err(ValidationError::new("empty_slug"))
|
||||||
|
} else if slug.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\n', '\t'][..]) {
|
||||||
|
Err(ValidationError::new("slug_illegal_char"))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user