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

Correct field order in changes.csv (#228)

This commit is contained in:
Sascha L. Teichmann 2022-07-18 18:37:55 +02:00 committed by GitHub
parent 8e18b6f36f
commit 86a015d6bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 11 deletions

View file

@ -741,6 +741,10 @@ func (p *processor) checkChanges(base string, mask whereType) error {
var times []time.Time
var files []csaf.AdvisoryFile
c := csv.NewReader(res.Body)
const (
pathColumn = 0
timeColumn = 1
)
for {
r, err := c.Read()
if err == io.EOF {
@ -752,11 +756,13 @@ func (p *processor) checkChanges(base string, mask whereType) error {
if len(r) < 2 {
return nil, nil, errors.New("not enough columns")
}
t, err := time.Parse(time.RFC3339, r[0])
t, err := time.Parse(time.RFC3339, r[timeColumn])
if err != nil {
return nil, nil, err
}
times, files = append(times, t), append(files, csaf.PlainAdvisoryFile(r[1]))
times, files =
append(times, t),
append(files, csaf.PlainAdvisoryFile(r[pathColumn]))
}
return times, files, nil
}()