aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-12 08:26:15 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-12 08:26:15 +0100
commitd13a7187afb149b0c2cb2acfba7f0598d8af26b7 (patch)
tree8929b1d3a3170eab6058ca78d2d8c1db73871446 /guix-data-service
parent767e60b2b3c62f7f3fc185f828fa58b868764150 (diff)
downloaddata-service-d13a7187afb149b0c2cb2acfba7f0598d8af26b7.tar
data-service-d13a7187afb149b0c2cb2acfba7f0598d8af26b7.tar.gz
Fix request->path-components-and-mime-type
Previously, it wouldn't pull the mime types out of the request properly, I think it does a better job of that now.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/web/util.scm13
1 files changed, 8 insertions, 5 deletions
diff --git a/guix-data-service/web/util.scm b/guix-data-service/web/util.scm
index d5c18c4..439c581 100644
--- a/guix-data-service/web/util.scm
+++ b/guix-data-service/web/util.scm
@@ -53,10 +53,13 @@
path))
(map car extensions-to-mime-types)))
+ (define accept-mime-types
+ (map car (request-accept request)))
+
(match (split-and-decode-uri-path (uri-path (request-uri request)))
(()
(values '()
- (or (request-accept request)
+ (or accept-mime-types
(list 'text/html))))
((single-component)
(if (ends-with-recognised-extension? single-component)
@@ -65,10 +68,10 @@
(values (list (string-join first-parts "."))
(or (cons
(assoc-ref extensions-to-mime-types extension)
- (or (request-accept request)
+ (or accept-mime-types
(list 'text/html)))))))
(values (list single-component)
- (or (request-accept request)
+ (or accept-mime-types
(list 'text/html)))))
((first-components ... last-component)
(if (ends-with-recognised-extension? last-component)
@@ -78,11 +81,11 @@
(list (string-join first-parts ".")))
(or (cons
(assoc-ref extensions-to-mime-types extension)
- (or (request-accept request)
+ (or accept-mime-types
(list 'text/html)))))))
(values (append first-components
(list last-component))
- (or (request-accept request)
+ (or accept-mime-types
(list 'text/html)))))))
(define (file-extension file-name)