[Top][All Lists]

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

branch master updated: http: Handle wrong build number.

From: Mathieu Othacehe
Subject: branch master updated: http: Handle wrong build number.
Date: Sun, 02 Aug 2020 09:56:20 -0400

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

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 7696829  http: Handle wrong build number.
7696829 is described below

commit 769682924c8f8d26d426f8111a538580ec5b2b20
Author: Mathieu Othacehe <>
AuthorDate: Sun Aug 2 15:50:59 2020 +0200

    http: Handle wrong build number.
    The request "/build/1234)" causes a select query on the whole Builds table,
    because failed "string->number" conversion is not handled.
    * src/cuirass/http.scm (url-handler): Handle erroneous id -> number 
    on "/build/id" route.
 src/cuirass/http.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index e7f0da7..fdcdc06 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -354,10 +354,11 @@ Hydra format."
      (respond-json (object->json-string
                     (list->vector (db-get-specifications)))))
     (('GET "build" id)
-     (let ((hydra-build (handle-build-request
-                         (if (string-suffix? ".drv" id)
-                             (string-append (%store-prefix) "/" id)
-                             (string->number id)))))
+     (let* ((build (if (string-suffix? ".drv" id)
+                       (string-append (%store-prefix) "/" id)
+                       (string->number id)))
+            (hydra-build (and build
+                              (handle-build-request build))))
        (if hydra-build
            (respond-json (object->json-string hydra-build))
            (respond-build-not-found id))))

reply via email to

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