From ca3abcbae5e8e1ef5102af5645bd6f75a554961e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 28 Nov 2022 13:27:43 +0000 Subject: web: server: Serve path/index.html if path ends in /. * tissue/web/server.scm (handler): Serve path/index.html if path ends in /. --- tissue/web/server.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tissue') diff --git a/tissue/web/server.scm b/tissue/web/server.scm index fa26aa5..bfe3992 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -310,11 +310,15 @@ See `start-web-server' for documentation of HOSTS." ;; Static files ((let ((file-path (find file-exists? - ;; Try path and path.html. - (list (string-append (assq-ref host-parameters 'website-directory) - "/" path) - (string-append (assq-ref host-parameters 'website-directory) - "/" path ".html"))))) + (if (string-suffix? "/" path) + ;; Try path/index.html. + (list (string-append (assq-ref host-parameters 'website-directory) + path "index.html")) + ;; Try path and path.html. + (list (string-append (assq-ref host-parameters 'website-directory) + "/" path) + (string-append (assq-ref host-parameters 'website-directory) + "/" path ".html")))))) (and file-path ;; Check that the file really is within the document ;; root. -- cgit v1.2.3