From 0b7a1d9f0276e389b655097d432e578d1cc0d7d1 Mon Sep 17 00:00:00 2001 From: Tim Lee Date: Fri, 10 Jan 2025 18:36:53 -0500 Subject: [PATCH] Do not panic on missing vulnerabilities file (#25081) --- cmd/cve/generate.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/cve/generate.go b/cmd/cve/generate.go index fb946590dc51..eaff03b60eb9 100644 --- a/cmd/cve/generate.go +++ b/cmd/cve/generate.go @@ -92,6 +92,11 @@ func main() { fileNameRaw := filepath.Join(*dbDir, fileFmt(suffix, "json", "")) fileName := filepath.Join(*dbDir, fileFmt(suffix, "json", "gz")) metaName := filepath.Join(*dbDir, fileFmt(suffix, "meta", "")) + // skip if file does not exist + if _, err := os.Stat(fileNameRaw); os.IsNotExist(err) { + logger.Log("msg", "Skipping metadata generation for missing file", "file", fileNameRaw) + continue + } err := nvdsync.CompressFile(fileNameRaw, fileName) if err != nil { panic(err)