guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Fix fetching nar files with a .json extension


From: Christopher Baines
Subject: branch master updated: Fix fetching nar files with a .json extension
Date: Mon, 01 Jun 2020 14:12:35 -0400

This is an automated email from the git hooks/post-receive script.

cbaines pushed a commit to branch master
in repository data-service.

The following commit(s) were added to refs/heads/master by this push:
     new f8de7cf  Fix fetching nar files with a .json extension
f8de7cf is described below

commit f8de7cf42e83333fcdff5396db8da4e35acfc2e9
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Jun 1 19:11:43 2020 +0100

    Fix fetching nar files with a .json extension
    
    Previously, the .json extension would be stripped, resulting in a 404, this
    fixes that.
---
 guix-data-service/web/nar/controller.scm | 30 ++++++++++++++++++++----------
 1 file 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]