1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Write directory_urls in provider if write indices.

This commit is contained in:
Sascha L. Teichmann 2022-07-30 12:20:21 +02:00
parent 4c0785c060
commit 8af0aeea46
2 changed files with 23 additions and 0 deletions

View file

@ -466,6 +466,18 @@ func (pmd *ProviderMetadata) Defaults() {
}
}
// AddDirectoryDistribution adds a directory based distribution
// with a given url to the provider metadata.
func (pmd *ProviderMetadata) AddDirectoryDistribution(url string) {
// Avoid duplicates.
for i := range pmd.Distributions {
if pmd.Distributions[i].DirectoryURL == url {
return
}
}
pmd.Distributions = append(pmd.Distributions, Distribution{DirectoryURL: url})
}
// Validate checks if the feed is valid.
// Returns an error if the validation fails otherwise nil.
func (f *Feed) Validate() error {