fix(scan): returns 400 when artifact not support by scanner (#13785)

Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
He Weiwei 2020-12-17 16:58:49 +08:00 committed by GitHub
parent 164acad24f
commit 792dcc4ac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -548,6 +548,8 @@ paths:
responses:
'202':
$ref: '#/responses/202'
'400':
$ref: '#/responses/400'
'401':
$ref: '#/responses/401'
'403':

View File

@ -192,7 +192,7 @@ func (bc *basicController) Scan(ctx context.Context, artifact *ar.Artifact, opti
}
if !scannable {
return errors.Errorf("the configured scanner %s does not support scanning artifact with mime type %s", r.Name, artifact.ManifestMediaType)
return errors.BadRequestError(nil).WithMessage("the configured scanner %s does not support scanning artifact with mime type %s", r.Name, artifact.ManifestMediaType)
}
type Param struct {