Skip to content
Snippets Groups Projects
Unverified Commit 76968292 authored by Mathieu Othacehe's avatar Mathieu Othacehe
Browse files

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.
parent 153b49c9
No related branches found
No related tags found
No related merge requests found
......@@ -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))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment