From 20853b93fc679c455d1dab0963b59557f30360c6 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 8 Jul 2022 16:11:08 +0530 Subject: web: server: Serve html files even without the html extension. * tissue/web/server.scm (handler): Serve html files even if they don't have the html extension. --- tissue/web/server.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tissue/web/server.scm b/tissue/web/server.scm index b5338b0..6b6f088 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -228,8 +228,12 @@ STATE-DIRECTORY." (MSet-get-matches-estimated mset) (assq-ref host-parameters 'css))))))))) ;; Static files - ((let ((file-path (string-append state-directory "/" hostname "/website" path))) - (and (file-exists? file-path) + ((let ((file-path + (find file-exists? + ;; Try path and path.html. + (list (string-append state-directory "/" hostname "/website" path) + (string-append state-directory "/" hostname "/website" path ".html"))))) + (and file-path ;; Check that the file really is within the document ;; root. (string-prefix? (string-append state-directory "/" hostname "/website/") -- cgit v1.2.3