summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fussy.lisp21
1 files changed, 11 insertions, 10 deletions
diff --git a/fussy.lisp b/fussy.lisp
index b7c8385..7416378 100644
--- a/fussy.lisp
+++ b/fussy.lisp
@@ -551,18 +551,19 @@ h1 {
(or (uiop:file-exists-p (robots-path-name))
""))
+(defun theme-image-pathname (pkg theme img)
+ (uiop:ensure-pathname
+ (format nil "~a/~a/~a/~a"
+ (full-theme-image-directory)
+ pkg
+ theme
+ img)))
+
(lzb:defendpoint* :get "/images/:pkg:/:theme:/:image:" () ()
"Endpoint for serving theme preview images"
- (let ((file-path
- (pathname
- (format nil "~a/~a/~a/~a"
- (full-theme-image-directory)
- pkg
- theme
- image))))
- (unless (uiop:file-exists-p file-path)
- (lzb:http-err 404 "no such file"))
- file-path))
+ (a:if-let (file-path (theme-image-pathname pkg theme image))
+ file-path
+ (lzb:http-err 404 "No such file")))
(defun a-string (s) s)