guix-commits
[Top][All Lists]
Advanced

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

02/03: Render a branch not found page if the branch doesn't exist


From: Christopher Baines
Subject: 02/03: Render a branch not found page if the branch doesn't exist
Date: Sun, 20 Nov 2022 10:44:52 -0500 (EST)

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

commit e87a8124bfd2b990489eaa385030d50a75451ee7
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Nov 19 10:07:17 2022 +0000

    Render a branch not found page if the branch doesn't exist
---
 guix-data-service/web/repository/controller.scm | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/guix-data-service/web/repository/controller.scm 
b/guix-data-service/web/repository/controller.scm
index 752c424..cf6d07f 100644
--- a/guix-data-service/web/repository/controller.scm
+++ b/guix-data-service/web/repository/controller.scm
@@ -147,15 +147,21 @@
                               (data_available  . ,data-available?))))
                          revisions))))))
            (else
-            (render-html
-             #:sxml (if (any-invalid-query-parameters? parsed-query-parameters)
-                        (view-branch repository-id
-                                     branch-name parsed-query-parameters '())
-                        (view-branch
-                         repository-id
-                         branch-name
-                         parsed-query-parameters
-                         revisions))))))))
+            (if (null? revisions)
+                (render-html
+                 #:sxml (general-not-found
+                         "Branch not found"
+                         "")
+                 #:code 404)
+                (render-html
+                 #:sxml (if (any-invalid-query-parameters? 
parsed-query-parameters)
+                            (view-branch repository-id
+                                         branch-name parsed-query-parameters 
'())
+                            (view-branch
+                             repository-id
+                             branch-name
+                             parsed-query-parameters
+                             revisions)))))))))
     (('GET "repository" repository-id "branch" branch-name "package" 
package-name)
      (letpar& ((package-versions
                 (with-thread-postgresql-connection



reply via email to

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