From eb41d6b36f742f1ce87bf655ff36f1fe59de6427 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 26 Jul 2023 00:25:44 +0900 Subject: [PATCH] pkg/cache: skip creating reverse URL files for oci Signed-off-by: Akihiro Suda --- pkg/cache/cache.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index be384df..58e271d 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -398,7 +398,7 @@ func (c *Cache) writeMetadataFiles(sha256sum string, u *url.URL, m *Metadata) er return fmt.Errorf("failed to create %q: %w", metadataFileAbs, err) } } - if u != nil { + if u != nil && u.Scheme != "oci" && !strings.HasPrefix(u.Scheme, "oci+") { revURLFileAbs, err := c.ReverseURLFileAbsPath(u) if err != nil { return err @@ -432,6 +432,9 @@ func (c *Cache) MetadataBySHA256(sha256sum string) (*Metadata, error) { // Not always available. // Do not use this unless you are sure that the URL is unique. func (c *Cache) SHA256ByOriginURL(u *url.URL) (string, error) { + if u.Scheme == "oci" || strings.HasPrefix(u.Scheme, "oci+") { + return "", fmt.Errorf("oci URL scheme is not supported") + } revUrlFileAbs, err := c.ReverseURLFileAbsPath(u) if err != nil { return "", err