aldryn / aldryn-blog

aldryn-blog IS DEPRECATED. PLEASE USE aldryn-newsblog!
Other
20 stars 35 forks source link

Slug validation missing #62

Closed gpoulin closed 9 years ago

gpoulin commented 10 years ago

When a slug is provided during the creation of a post, the validity of the slug is not verify. For example, if the slug contain space or commas I'm getting:

NoReverseMatch: Reverse for 'post-detail' with arguments '()' and
keyword arguments '{'year': 2014, 'slug': u'dummy, foo, bar', 'day': 8,
'month': 5}' not found. 1 pattern(s) tried: [u'en/blog/(?P<year>\\d{4})/
(?P<month>\\d{1,2})/(?P<day>\\d{1,2})/(?P<slug>\\w[-\\w]*)/$']

In addition, if the slug is not provided and the title doesn't contain any valid character (Cyrillic/Chinese/Arab... title) the slug created is an empty string and the same bug occur.

I can try to provide a pull request, this weekend.

adrien-delhorme commented 10 years ago

And if the slug is left empty and there already is a page with a similar slug, an IntegrityError is raised:

IntegrityError: duplicate key value violates unique constraint "aldryn_blog_post_slug_key"

czpython commented 9 years ago

Fixed by 885e897a3a80bbed260b7b1ba9fca41035bc872e

czpython commented 9 years ago

@adrien-delhorme I've opened ticket #79 to track this bug. Thanks.