From d7ffd1b7d72db1dc45edc114f055cfa96b9c2198 Mon Sep 17 00:00:00 2001 From: lukasepple Date: Tue, 9 Dec 2014 20:55:57 +0100 Subject: [PATCH] error handling in slugify --- src/content.lisp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/content.lisp b/src/content.lisp index 78d16a0..36e30a3 100644 --- a/src/content.lisp +++ b/src/content.lisp @@ -39,7 +39,11 @@ (defun slugify (string) "Return a version of STRING suitable for use as a URL." - (remove-if-not #'slug-char-p (substitute-if #\- #'unicode-space-p string))) + (let ((slugified (remove-if-not #'slug-char-p + (substitute-if #\- #'unicode-space-p string)))) + (if (= 0 (length slugified)) + (error "Post title '~a' does not contain characters suitable for a slug!" string) + slugified))) ;; Content Types