api: return 400 if we can't extract a layer
This commit is contained in:
parent
343ce39865
commit
e8b16175ef
@ -21,6 +21,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/coreos/clair/database"
|
"github.com/coreos/clair/database"
|
||||||
|
"github.com/coreos/clair/utils"
|
||||||
cerrors "github.com/coreos/clair/utils/errors"
|
cerrors "github.com/coreos/clair/utils/errors"
|
||||||
"github.com/coreos/clair/worker"
|
"github.com/coreos/clair/worker"
|
||||||
)
|
)
|
||||||
@ -55,7 +56,7 @@ func WriteHTTPError(w http.ResponseWriter, httpStatus int, err error) {
|
|||||||
httpStatus = http.StatusNotFound
|
httpStatus = http.StatusNotFound
|
||||||
case database.ErrTransaction, database.ErrBackendException:
|
case database.ErrTransaction, database.ErrBackendException:
|
||||||
httpStatus = http.StatusServiceUnavailable
|
httpStatus = http.StatusServiceUnavailable
|
||||||
case worker.ErrParentUnknown, worker.ErrUnsupported:
|
case worker.ErrParentUnknown, worker.ErrUnsupported, utils.ErrCouldNotExtract, utils.ErrExtractedFileTooBig:
|
||||||
httpStatus = http.StatusBadRequest
|
httpStatus = http.StatusBadRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user