From 3c6cd75da8c81dd41356164d240c39e55a7c683f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 15 Mar 2022 02:00:13 +0100 Subject: HTML directory table now gives 404 instead of 500 --- module/calp/server/routes.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm index 07ea67f0..2e282f91 100644 --- a/module/calp/server/routes.scm +++ b/module/calp/server/routes.scm @@ -475,11 +475,15 @@ ;; Note that `path' will most likely start with a slash (GET "/static:path{.*}" (path) - (return - '((content-type text/html)) - (sxml->html-string - ;; TODO 404 instead of 500 here - (directory-table (static-dir) path)))) + (catch + 'misc-error + (lambda () (return + '((content-type text/html)) + (sxml->html-string + (directory-table (static-dir) path)))) + (lambda (err proc fmt fmt-args data) + (return (build-response code: 404) + (format #f "~?" fmt fmt-args))))) ;; This is almost the same as /static/, but with the difference that ;; we produce these images during runtime -- cgit v1.2.3