diff options
author | David Thompson <davet@gnu.org> | 2015-06-15 21:45:23 -0400 |
---|---|---|
committer | David Thompson <davet@gnu.org> | 2015-06-15 21:48:29 -0400 |
commit | 69c000388f2b0b24f56e1551609f19b31a1037ad (patch) | |
tree | de8659ff46265492b0a37bd48f03e1d7cdd5faea | |
parent | 18e0136136da0c9ef65dee83b9770e42ea42af75 (diff) |
view: json: Gracefully handle license lists and bogus licenses.
* guix-web/view/json.scm (license->json): Add 'match' form to handle
bogus licenses.
Co-Authored-By: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | guix/web/view/json.scm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/guix/web/view/json.scm b/guix/web/view/json.scm index 4fe45a2..e3f8bc1 100644 --- a/guix/web/view/json.scm +++ b/guix/web/view/json.scm @@ -32,10 +32,17 @@ generations-json)) (define (license->json license) - (json - (object - ("name" ,(license-name license)) - ("uri" ,(license-uri license))))) + (match license + ((? license? license) + (json + (object + ("name" ,(license-name license)) + ("uri" ,(license-uri license))))) + (_ ; a dubious license that we'd rather handle gracefully + (json + (object + ("name" ,(object->string license)) + ("uri" "http://www.gnu.org")))))) (define* (package->json package #:optional serialize-inputs?) (define (serialize-license package) |