Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
  • Loading branch information
Two-Hearts committed Sep 25, 2024
1 parent 997f6d9 commit 69f6b81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 2 additions & 1 deletion internal/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ func TrimFileExtension(fileName string) string {
return strings.TrimSuffix(fileName, filepath.Ext(fileName))
}

// WriteFile writes content to path with all parent directories created.
// WriteFile writes content to a temporary file and move it to path with all
// parent directories created.
// If path already exists and is a file, WriteFile overwrites it.
func WriteFile(path string, content []byte) (writeErr error) {
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
Expand Down
9 changes: 0 additions & 9 deletions verifier/crl/crl.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"errors"
"fmt"
"io/fs"
nurl "net/url"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -82,10 +81,6 @@ func (c *FileCache) Get(ctx context.Context, url string) (*corecrl.Bundle, error
logger := log.GetLogger(ctx)
logger.Debugf("Retrieving crl bundle from file cache with key %q ...", url)

// sanity check
if _, err := nurl.Parse(url); err != nil {
return nil, fmt.Errorf("invalid url: %w", err)
}
// get content from file cache
contentBytes, err := os.ReadFile(filepath.Join(c.root, c.fileName(url)))
if err != nil {
Expand Down Expand Up @@ -131,10 +126,6 @@ func (c *FileCache) Set(ctx context.Context, url string, bundle *corecrl.Bundle)
logger := log.GetLogger(ctx)
logger.Debugf("Storing crl bundle to file cache with key %q ...", url)

// sanity check
if _, err := nurl.Parse(url); err != nil {
return fmt.Errorf("invalid url: %w", err)
}
if bundle == nil {
return errors.New("failed to store crl bundle in file cache: bundle cannot be nil")
}
Expand Down

0 comments on commit 69f6b81

Please sign in to comment.