mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2025-03-13 18:42:40 +00:00
Fix valid slug spec
This commit is contained in:
parent
08b7d100fd
commit
55a5a64b1a
1 changed files with 5 additions and 2 deletions
|
@ -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 a new issue