aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-06-01 19:11:43 +0100
committerChristopher Baines <mail@cbaines.net>2020-06-01 19:11:43 +0100
commitf8de7cf42e83333fcdff5396db8da4e35acfc2e9 (patch)
treeba5a4efbe47c86ab87d87865e4e221e715e0f50a /guix-data-service/web
parentb6754c8a4c1135a803fa72fbf4208d46c301b105 (diff)
downloaddata-service-f8de7cf42e83333fcdff5396db8da4e35acfc2e9.tar
data-service-f8de7cf42e83333fcdff5396db8da4e35acfc2e9.tar.gz
Fix fetching nar files with a .json extension
Previously, the .json extension would be stripped, resulting in a 404, this fixes that.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/nar/controller.scm30
1 files changed, 20 insertions, 10 deletions
diff --git a/guix-data-service/web/nar/controller.scm b/guix-data-service/web/nar/controller.scm
index 749551f..606040e 100644
--- a/guix-data-service/web/nar/controller.scm
+++ b/guix-data-service/web/nar/controller.scm
@@ -70,16 +70,26 @@
(('GET "substitutes")
(render-html
#:sxml (view-substitutes (%narinfo-signing-public-key))))
- (('GET "nar" file-name)
- (render-nar request
- mime-types
- conn
- (string-append "/gnu/store/" file-name)))
- (('GET "nar" "lzip" file-name)
- (render-lzip-nar request
- mime-types
- conn
- (string-append "/gnu/store/" file-name)))
+ (('GET "nar" _)
+ ;; These routes are a little special, as the extensions aren't used for
+ ;; content negotiation, so just use the path from the request
+ (let* ((path (uri-path (request-uri request)))
+ (file-name
+ (last (string-split path #\/))))
+ (render-nar request
+ mime-types
+ conn
+ (string-append "/gnu/store/" file-name))))
+ (('GET "nar" "lzip" _)
+ ;; These routes are a little special, as the extensions aren't used for
+ ;; content negotiation, so just use the path from the request
+ (let* ((path (uri-path (request-uri request)))
+ (file-name
+ (last (string-split path #\/))))
+ (render-lzip-nar request
+ mime-types
+ conn
+ (string-append "/gnu/store/" file-name))))
(('GET (? .narinfo-suffix path))
(render-narinfo request
conn