From e8b16175effcff9b9ead13aeadab7897f5331d37 Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Tue, 9 Feb 2016 18:12:44 -0500 Subject: [PATCH] api: return 400 if we can't extract a layer --- utils/http/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/http/http.go b/utils/http/http.go index 360c7ad8..81dfdc19 100644 --- a/utils/http/http.go +++ b/utils/http/http.go @@ -21,6 +21,7 @@ import ( "net/http" "github.com/coreos/clair/database" + "github.com/coreos/clair/utils" cerrors "github.com/coreos/clair/utils/errors" "github.com/coreos/clair/worker" ) @@ -55,7 +56,7 @@ func WriteHTTPError(w http.ResponseWriter, httpStatus int, err error) { httpStatus = http.StatusNotFound case database.ErrTransaction, database.ErrBackendException: httpStatus = http.StatusServiceUnavailable - case worker.ErrParentUnknown, worker.ErrUnsupported: + case worker.ErrParentUnknown, worker.ErrUnsupported, utils.ErrCouldNotExtract, utils.ErrExtractedFileTooBig: httpStatus = http.StatusBadRequest } }