1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Replaced JSON schema library with a MIT licenensed one.

This commit is contained in:
Sascha L. Teichmann 2021-12-03 02:28:16 +01:00
parent 78f0b2db0b
commit 8c272fef2a
6 changed files with 56 additions and 36 deletions

View file

@ -190,23 +190,26 @@ func (c *controller) upload(rw http.ResponseWriter, r *http.Request) {
return
}
validationErrors, err := csaf.Validate(data)
if err != nil {
c.failed(rw, "upload.html", err)
return
}
if len(validationErrors) > 0 {
c.multiFailed(rw, "upload.html", validationErrors)
return
}
var content interface{}
if err := json.Unmarshal(data, &content); err != nil {
c.failed(rw, "upload.html", err)
return
}
// Validate againt JSON schema.
if !c.cfg.NoValidation {
validationErrors, err := csaf.ValidateCSAF(content)
if err != nil {
c.failed(rw, "upload.html", err)
return
}
if len(validationErrors) > 0 {
c.multiFailed(rw, "upload.html", validationErrors)
return
}
}
ex, err := newExtraction(content)
if err != nil {
c.failed(rw, "upload.html", err)