aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/web/controller.scm14
-rw-r--r--guix-data-service/web/view/html.scm7
2 files changed, 14 insertions, 7 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 55a136e..f497d32 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -20,6 +20,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (ice-9 pretty-print)
+ #:use-module (ice-9 textual-ports)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
@@ -30,6 +31,7 @@
#:use-module (texinfo plain-text)
#:use-module (squee)
#:use-module (json)
+ #:use-module (guix-data-service config)
#:use-module (guix-data-service comparison)
#:use-module (guix-data-service database)
#:use-module (guix-data-service model git-branch)
@@ -721,8 +723,16 @@
200
500))))
(('GET "README")
- (render-html
- #:sxml (readme)))
+ (let ((filename (string-append (%config 'doc-dir) "/README.html")))
+ (if (file-exists? filename)
+ (render-html
+ #:sxml (readme (call-with-input-file filename
+ get-string-all)))
+ (render-html
+ #:sxml (general-not-found
+ "README not found"
+ "The README.html file does not exist")
+ #:code 404))))
(_
(with-postgresql-connection
"web"
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index d0b480b..11833de 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -23,7 +23,6 @@
#:use-module (guix-data-service web util)
#:use-module (ice-9 vlist)
#:use-module (ice-9 match)
- #:use-module (ice-9 textual-ports)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (texinfo)
@@ -223,7 +222,7 @@
'())))
'())))))
-(define (readme)
+(define (readme contents)
(layout
#:body
`(,(header)
@@ -238,9 +237,7 @@
(@ (class "row"))
(div
(@ (class "col-sm-12"))
- (raw ,(call-with-input-file
- (string-append (%config 'doc-dir) "/README.html")
- get-string-all))))))))
+ (raw ,contents)))))))
(define (index git-repositories-and-revisions)
(layout