From e87a8124bfd2b990489eaa385030d50a75451ee7 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 19 Nov 2022 10:07:17 +0000 Subject: [PATCH] Render a branch not found page if the branch doesn't exist --- .../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