mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Check if the file name is valid
This commit is contained in:
parent
6a60e8d8ce
commit
a8493c0dd2
1 changed files with 5 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/csaf-poc/csaf_distribution/csaf"
|
"github.com/csaf-poc/csaf_distribution/csaf"
|
||||||
"github.com/csaf-poc/csaf_distribution/util"
|
"github.com/csaf-poc/csaf_distribution/util"
|
||||||
|
|
@ -68,6 +69,10 @@ func run(opts *options, files []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
// Check if the file name is valid.
|
||||||
|
if !util.ConfirmingFileName(filepath.Base(file)) {
|
||||||
|
fmt.Printf("%q is not a valid advisory name.\n", file)
|
||||||
|
}
|
||||||
doc, err := loadJSONFromFile(file)
|
doc, err := loadJSONFromFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error: loading %q as JSON failed: %v\n", file, err)
|
log.Printf("error: loading %q as JSON failed: %v\n", file, err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue