diff --git a/pkg/cosign/tuf/client.go b/pkg/cosign/tuf/client.go index 1d2ac38efc5..2edbe481e2e 100644 --- a/pkg/cosign/tuf/client.go +++ b/pkg/cosign/tuf/client.go @@ -29,7 +29,6 @@ import ( "os" "path/filepath" "runtime" - "strconv" "strings" "time" @@ -213,7 +212,7 @@ func getRoot(meta map[string]json.RawMessage, ed fs.FS) (json.RawMessage, error) if !ok { return nil, errors.New("fs.ReadFileFS unimplemented for embedded repo") } - trustedRoot, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "root.json"))) + trustedRoot, err := rd.ReadFile(filepath.Join("repository", "root.json")) if err != nil { return nil, err } @@ -513,11 +512,11 @@ func rootCacheDir() string { } func cachedRemote(cacheRoot string) string { - return filepath.FromSlash(filepath.Join(cacheRoot, "remote.json")) + return filepath.Join(cacheRoot, "remote.json") } func cachedTargetsDir(cacheRoot string) string { - return filepath.FromSlash(filepath.Join(cacheRoot, "targets")) + return filepath.Join(cacheRoot, "targets") } // Local store implementations @@ -563,7 +562,7 @@ func (e embeddedLocalStore) GetMeta() (map[string]json.RawMessage, error) { // Skip the target directory or other strange files. continue } - b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", entry.Name()))) + b, err := rd.ReadFile(filepath.Join("repository", entry.Name())) if err != nil { return nil, fmt.Errorf("reading embedded file: %w", err) } @@ -703,7 +702,7 @@ func (e *embeddedWrapper) Get(p string) ([]byte, error) { if !ok { return nil, errors.New("fs.ReadFileFS unimplemented for embedded repo") } - b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "targets", p))) + b, err := rd.ReadFile(filepath.Join("repository", "targets", p)) if err != nil { return nil, err } @@ -723,7 +722,7 @@ func (e *embeddedWrapper) Set(name string, b []byte) error { if !ok { return errors.New("fs.ReadFileFS unimplemented for embedded repo") } - entries, err := ed.ReadDir(filepath.FromSlash(filepath.Join("repository", "targets"))) + entries, err := ed.ReadDir(filepath.Join("repository", "targets")) if err != nil { return err } @@ -733,7 +732,7 @@ func (e *embeddedWrapper) Set(name string, b []byte) error { } // Copy targets to the writeable store so we can find all of them later. for _, entry := range entries { - b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "targets", entry.Name()))) + b, err := rd.ReadFile(filepath.Join("repository", "targets", entry.Name())) if err != nil { return fmt.Errorf("reading embedded file: %w", err) } @@ -792,11 +791,15 @@ func (d *diskCache) Set(p string, b []byte) error { } func noCache() bool { - b, err := strconv.ParseBool(os.Getenv(SigstoreNoCache)) - if err != nil { - return false - } - return b + // TODO: Remove! + return true + /* + b, err := strconv.ParseBool(os.Getenv(SigstoreNoCache)) + if err != nil { + return false + } + return b + */ } func remoteFromMirror(ctx context.Context, mirror string) (client.RemoteStore, error) {