summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-11-28 13:27:43 +0000
committerArun Isaac2022-11-28 13:29:36 +0000
commitca3abcbae5e8e1ef5102af5645bd6f75a554961e (patch)
tree653bbd2a0169b93887e0ac5415c44e5411ea93c6
parent7646ccca5d5fd3e4fecdb21980460cdb544a4847 (diff)
downloadtissue-ca3abcbae5e8e1ef5102af5645bd6f75a554961e.tar.gz
tissue-ca3abcbae5e8e1ef5102af5645bd6f75a554961e.tar.lz
tissue-ca3abcbae5e8e1ef5102af5645bd6f75a554961e.zip
web: server: Serve path/index.html if path ends in /.
* tissue/web/server.scm (handler): Serve path/index.html if path ends in /.
-rw-r--r--tissue/web/server.scm14
1 files changed, 9 insertions, 5 deletions
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.