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 conversion on "/build/id" route.
This commit is contained in:
parent
153b49c952
commit
769682924c
|
@ -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))))
|
||||
|
|
Loading…
Reference in New Issue