1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Replace 'confirming filename' with 'conforming filename'

This commit is contained in:
Sascha L. Teichmann 2023-02-02 22:36:37 +01:00
parent b80163c35f
commit ffb29f5ba4
10 changed files with 22 additions and 22 deletions

View file

@ -501,10 +501,10 @@ func (w *worker) mirrorFiles(tlpLabel csaf.TLPLabel, files []csaf.AdvisoryFile)
continue
}
// Ignore not confirming filenames.
// Ignore not conforming filenames.
filename := filepath.Base(u.Path)
if !util.ConfirmingFileName(filename) {
log.Printf("Not confirming filename %q. Ignoring.\n", filename)
if !util.ConformingFileName(filename) {
log.Printf("Not conforming filename %q. Ignoring.\n", filename)
continue
}

View file

@ -445,10 +445,10 @@ func (p *processor) integrity(
}
p.checkTLS(u)
// Check if the filename is confirming.
// Check if the filename is conforming.
p.badFilenames.use()
if !util.ConfirmingFileName(filepath.Base(u)) {
p.badFilenames.error("%s has not a confirming filename.", u)
if !util.ConformingFileName(filepath.Base(u)) {
p.badFilenames.error("%s has not a conforming filename.", u)
}
var folderYear *int
@ -1054,14 +1054,14 @@ func (p *processor) checkMissing(string) error {
}
// checkInvalid goes over all found adivisories URLs and checks
// if file name confirms to standard.
// if file name conforms to standard.
func (p *processor) checkInvalid(string) error {
p.badDirListings.use()
var invalids []string
for f := range p.alreadyChecked {
if !util.ConfirmingFileName(filepath.Base(f)) {
if !util.ConformingFileName(filepath.Base(f)) {
invalids = append(invalids, f)
}
}

View file

@ -66,7 +66,7 @@ func (r *filenameReporter) report(p *processor, domain *Domain) {
if !p.badFilenames.used() {
req.message(InfoType, "No filenames checked for conformance")
} else if len(p.badFilenames) == 0 {
req.message(InfoType, "All found filenames are confirming.")
req.message(InfoType, "All found filenames are conforming.")
} else {
req.Append(p.badFilenames)
}

View file

@ -262,10 +262,10 @@ func (d *downloader) downloadFiles(label csaf.TLPLabel, files []csaf.AdvisoryFil
continue
}
// Ignore not confirming filenames.
// Ignore not conforming filenames.
filename := filepath.Base(u.Path)
if !util.ConfirmingFileName(filename) {
log.Printf("Not confirming filename %q. Ignoring.\n", filename)
if !util.ConformingFileName(filename) {
log.Printf("Not conforming filename %q. Ignoring.\n", filename)
continue
}

View file

@ -47,8 +47,8 @@ func (c *controller) loadCSAF(r *http.Request) (string, []byte, error) {
return "", nil, errors.New("expected content type 'application/json'")
}
if !util.ConfirmingFileName(handler.Filename) {
return "", nil, errors.New("given csaf filename is not confirming")
if !util.ConformingFileName(handler.Filename) {
return "", nil, errors.New("given csaf filename is not conforming")
}
var buf bytes.Buffer

View file

@ -72,7 +72,7 @@ func (c *controller) bind(pim *pathInfoMux) {
pim.handleFunc("/api/create", c.auth(api(c.create)))
}
// authenticate checks if the incoming request confirms with the
// authenticate checks if the incoming request conforms with the
// configured authentication mechanism.
func (c *controller) authenticate(r *http.Request) bool {

View file

@ -314,8 +314,8 @@ func (p *processor) uploadRequest(filename string) (*http.Request, error) {
// It prints the response messages.
func (p *processor) process(filename string) error {
if bn := filepath.Base(filename); !util.ConfirmingFileName(bn) {
return fmt.Errorf("%q is not a confirming file name", bn)
if bn := filepath.Base(filename); !util.ConformingFileName(bn) {
return fmt.Errorf("%q is not a conforming file name", bn)
}
req, err := p.uploadRequest(filename)

View file

@ -70,7 +70,7 @@ func run(opts *options, files []string) error {
for _, file := range files {
// Check if the file name is valid.
if !util.ConfirmingFileName(filepath.Base(file)) {
if !util.ConformingFileName(filepath.Base(file)) {
fmt.Printf("%q is not a valid advisory name.\n", file)
}
doc, err := loadJSONFromFile(file)

View file

@ -33,8 +33,8 @@ func CleanFileName(s string) string {
return invalidRune.ReplaceAllString(s, "_") + ".json"
}
// ConfirmingFileName checks if the given filename is confirming the standard.
func ConfirmingFileName(fname string) bool {
// ConformingFileName checks if the given filename conforms to the standard.
func ConformingFileName(fname string) bool {
return fname == CleanFileName(fname)
}

View file

@ -23,7 +23,7 @@ func TestCleanFileName(t *testing.T) {
}
}
func TestConfirmingFileName(t *testing.T) {
func TestConformingFileName(t *testing.T) {
for _, x := range []struct {
s string
b bool
@ -41,7 +41,7 @@ func TestConfirmingFileName(t *testing.T) {
{`abc_.htm__l`, false},
{`foo+BAR`, false},
} {
if got := ConfirmingFileName(x.s); got != x.b {
if got := ConformingFileName(x.s); got != x.b {
t.Errorf("%q: Expected %t but got %t.", x.s, x.b, got)
}
}