Ver código fonte

Merge pull request #75 from lukasepple/master

error handling in slugify
Javier Olaechea 10 anos atrás
pai
commit
66928295e3
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      src/content.lisp

+ 5 - 1
src/content.lisp

@@ -39,7 +39,11 @@
39 39
 
40 40
 (defun slugify (string)
41 41
   "Return a version of STRING suitable for use as a URL."
42
-  (remove-if-not #'slug-char-p (substitute-if #\- #'unicode-space-p string)))
42
+  (let ((slugified (remove-if-not #'slug-char-p 
43
+                                  (substitute-if #\- #'unicode-space-p string))))
44
+	(if (zerop (length slugified))
45
+            (error "Post title '~a' does not contain characters suitable for a slug!" string 
46
+            slugified)))
43 47
 
44 48
 ;; Content Types
45 49