Fix valid slug spec
This commit is contained in:
parent
08b7d100fd
commit
55a5a64b1a
@ -1,4 +1,7 @@
|
||||
use activitystreams::collection::{OrderedCollection, OrderedCollectionPage};
|
||||
use activitystreams::{
|
||||
collection::{OrderedCollection, OrderedCollectionPage},
|
||||
iri_string::{spec::IriSpec, validate::iri_reference},
|
||||
};
|
||||
use diesel::SaveChangesDsl;
|
||||
use rocket::{
|
||||
http::ContentType,
|
||||
@ -80,7 +83,7 @@ pub struct NewBlogForm {
|
||||
|
||||
fn valid_slug(title: &str) -> Result<(), ValidationError> {
|
||||
let slug = Blog::slug(title);
|
||||
if slug.is_empty() {
|
||||
if slug.is_empty() || iri_reference::<IriSpec>(slug).is_err() {
|
||||
Err(ValidationError::new("empty_slug"))
|
||||
} else {
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user