Skip to content

Commit

Permalink
refactor: remove temporary solution joinUrlPath and use joinPath from…
Browse files Browse the repository at this point in the history
… Go 1.19.1 net/url
  • Loading branch information
tschmidtb51 committed Sep 24, 2022
1 parent e4128b8 commit 6b9ecea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 329 deletions.
13 changes: 7 additions & 6 deletions cmd/csaf_checker/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (p *processor) integrity(
if u.IsAbs() {
return u
}
return util.JoinURLPath(b, u.String())
return b.JoinPath(u.String())
}

for _, f := range files {
Expand Down Expand Up @@ -715,7 +715,7 @@ func (p *processor) checkIndex(base string, mask whereType) error {
return err
}

index := util.JoinURLPath(bu, "index.txt").String()
index := bu.JoinPath("index.txt").String()

p.checkTLS(index)

Expand Down Expand Up @@ -773,7 +773,7 @@ func (p *processor) checkChanges(base string, mask whereType) error {
if err != nil {
return err
}
changes := util.JoinURLPath(bu, "changes.csv").String()
changes := bu.JoinPath("changes.csv").String()

p.checkTLS(changes)

Expand Down Expand Up @@ -1195,11 +1195,12 @@ func (p *processor) checkWellknown(domain string) string {
// 1. checks if the provider-metadata.json file is
// available under the /.well-known/csaf/ directory.
// 2. Then it checks the security.txt file by making HTTP request to fetch it.
// 3. After that it checks the existence of the CSAF field in the file
// content and tries to fetch the value of this field.
// 3. After that it checks the existence of the CSAF field in the file
// content and tries to fetch the value of this field.
// 4. Finally it checks if the "csaf.data.security.domain.tld" DNS record
// is available and serves the "provider-metadata.json".
///
//
// /
// If all three checks fail, errors are given,
// otherwise warnings for all failed checks.
// The function returns nil, unless errors outside the checks were found.
Expand Down
4 changes: 2 additions & 2 deletions csaf/advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (afp *AdvisoryFileProcessor) loadIndex(
return nil, err
}

indexURL := util.JoinURLPath(base, "index.txt").String()
indexURL := base.JoinPath("index.txt").String()
resp, err := afp.client.Get(indexURL)
if err != nil {
return nil, err
Expand All @@ -215,7 +215,7 @@ func (afp *AdvisoryFileProcessor) loadIndex(
continue
}
files = append(files,
PlainAdvisoryFile(util.JoinURLPath(base, u).String()))
PlainAdvisoryFile(base.JoinPath(u).String()))
}

if err := scanner.Err(); err != nil {
Expand Down
301 changes: 0 additions & 301 deletions util/joinpath.go

This file was deleted.

20 changes: 0 additions & 20 deletions util/joinpath_go119.go

This file was deleted.

0 comments on commit 6b9ecea

Please sign in to comment.