aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-20 01:43:29 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-20 01:43:29 +0100
commit380580a0a07154f175a2988bd90bece0933f4385 (patch)
tree33beaa46dec50b46db187ab3d03337cf722e846a
parentef7bb9a8f1ae04c4b8abb987e3f69cead3fd901c (diff)
router.lisp: Ensure redirect-url exists on route.
-rw-r--r--router.lisp15
1 files changed, 8 insertions, 7 deletions
diff --git a/router.lisp b/router.lisp
index 9e449b5..3b75874 100644
--- a/router.lisp
+++ b/router.lisp
@@ -72,8 +72,8 @@ Each entry is a cons of the form REDIRECT-PATH . TRIGGER-PATHS, where TRIGGER-PA
of paths of the trigger URL that will be redirected to REDIRECT-PATH. To redirect all paths except
TRIGGER-PATHS to REDIRECT-PATH, prefix this list with `not'.")
(redirect-url
- ""
- :type (or string quri:uri function symbol)
+ nil
+ :type (or null string quri:uri function symbol)
:documentation "The URL to redirect to.")
(original-url
nil
@@ -169,11 +169,12 @@ in a web buffer."))
(lambda (route)
(when (and (redirector-p route)
(with-slots (redirect-url) route
- (string= (quri:uri-host url)
- (etypecase redirect-url
- (string redirect-url)
- (quri:uri (quri:uri-host redirect-url))
- ((or function symbol) (funcall redirect-url))))))
+ (and redirect-url
+ (string= (quri:uri-host url)
+ (etypecase redirect-url
+ (string redirect-url)
+ (quri:uri (quri:uri-host redirect-url))
+ ((or function symbol) (funcall redirect-url)))))))
route))
(routes mode)))