mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Fixed problems with ROLIE in provider metadata.
This commit is contained in:
parent
05300ff1bb
commit
cd68a86a85
1 changed files with 8 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ type ROLIE struct {
|
||||||
// Distribution is a distribution of a CSAF feed.
|
// Distribution is a distribution of a CSAF feed.
|
||||||
type Distribution struct {
|
type Distribution struct {
|
||||||
DirectoryURL string `json:"directory_url,omitempty"`
|
DirectoryURL string `json:"directory_url,omitempty"`
|
||||||
Rolie []ROLIE `json:"rolie"`
|
Rolie *ROLIE `json:"rolie,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TimeStamp represents a time stamp in a CSAF feed.
|
// TimeStamp represents a time stamp in a CSAF feed.
|
||||||
|
|
@ -346,9 +346,9 @@ func (pk *PGPKey) Validate() error {
|
||||||
// Validate checks if the distribution is valid.
|
// Validate checks if the distribution is valid.
|
||||||
// Returns an error if the validation fails otherwise nil.
|
// Returns an error if the validation fails otherwise nil.
|
||||||
func (d *Distribution) Validate() error {
|
func (d *Distribution) Validate() error {
|
||||||
for i := range d.Rolie {
|
if d.Rolie != nil {
|
||||||
if err := d.Rolie[i].Validate(); err != nil {
|
if err := d.Rolie.Validate(); err != nil {
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -441,6 +441,7 @@ func NewProviderMetadataDomain(domain string, tlps []TLPLabel) *ProviderMetadata
|
||||||
feed := "csaf-feed-tlp-" + lt + ".json"
|
feed := "csaf-feed-tlp-" + lt + ".json"
|
||||||
url := JSONURL(domain + "/.well-known/csaf/" + lt + "/" + feed)
|
url := JSONURL(domain + "/.well-known/csaf/" + lt + "/" + feed)
|
||||||
|
|
||||||
|
t := t
|
||||||
feeds[i] = Feed{
|
feeds[i] = Feed{
|
||||||
Summary: "TLP:" + string(t) + " advisories",
|
Summary: "TLP:" + string(t) + " advisories",
|
||||||
TLPLabel: &t,
|
TLPLabel: &t,
|
||||||
|
|
@ -449,9 +450,9 @@ func NewProviderMetadataDomain(domain string, tlps []TLPLabel) *ProviderMetadata
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.Distributions = []Distribution{{
|
pm.Distributions = []Distribution{{
|
||||||
Rolie: []ROLIE{{
|
Rolie: &ROLIE{
|
||||||
Feeds: feeds,
|
Feeds: feeds,
|
||||||
}},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
return pm
|
return pm
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue