diff options
author | colin <colin@cicadas.surf> | 2023-05-26 08:47:36 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-05-26 08:47:36 -0700 |
commit | 660092480b858c2f34cc9c947105361ade233ddb (patch) | |
tree | aeec6db4cfe1b867ceb6dec73a96a6d69dd6459c /fussy.lisp | |
parent | 372e5d1691452d467239bcec39f1441f0204b244 (diff) |
refactored images endpoint
Diffstat (limited to 'fussy.lisp')
-rw-r--r-- | fussy.lisp | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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) |