mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Merge pull request #512 from csaf-poc/Download_without_tlp
Downloader: Add tlp label to path if no custom directory is configured. Refactor accordingly
This commit is contained in:
commit
2fe836bed7
1 changed files with 7 additions and 5 deletions
|
|
@ -621,26 +621,28 @@ nextAdvisory:
|
|||
continue
|
||||
}
|
||||
|
||||
if err := d.eval.Extract(`$.document.tracking.initial_release_date`, dateExtract, false, doc); err != nil {
|
||||
if err := d.eval.Extract(
|
||||
`$.document.tracking.initial_release_date`, dateExtract, false, doc,
|
||||
); err != nil {
|
||||
slog.Warn("Cannot extract initial_release_date from advisory",
|
||||
"url", file.URL())
|
||||
initialReleaseDate = time.Now()
|
||||
}
|
||||
initialReleaseDate = initialReleaseDate.UTC()
|
||||
|
||||
// Advisories that failed validation are store in a special folder.
|
||||
// Advisories that failed validation are stored in a special folder.
|
||||
var newDir string
|
||||
if valStatus != validValidationStatus {
|
||||
newDir = path.Join(d.cfg.Directory, failedValidationDir, lower)
|
||||
newDir = path.Join(d.cfg.Directory, failedValidationDir)
|
||||
} else {
|
||||
newDir = path.Join(d.cfg.Directory, lower)
|
||||
newDir = d.cfg.Directory
|
||||
}
|
||||
|
||||
// Do we have a configured destination folder?
|
||||
if d.cfg.Folder != "" {
|
||||
newDir = path.Join(newDir, d.cfg.Folder)
|
||||
} else {
|
||||
newDir = path.Join(newDir, strconv.Itoa(initialReleaseDate.Year()))
|
||||
newDir = path.Join(newDir, lower, strconv.Itoa(initialReleaseDate.Year()))
|
||||
}
|
||||
|
||||
if newDir != lastDir {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue