Compare commits

...

1 Commits

Author SHA1 Message Date
Blake Mizerany
d9ea2e5c7a inital pass at replacing ":" with "-" in image on-disk names 2024-03-14 11:30:06 -07:00
3 changed files with 4 additions and 14 deletions

View File

@ -795,10 +795,8 @@ func PruneLayers() error {
for _, blob := range blobs { for _, blob := range blobs {
name := blob.Name() name := blob.Name()
if runtime.GOOS == "windows" { name = strings.ReplaceAll(name, "-", ":")
name = strings.ReplaceAll(name, "-", ":") if strings.HasPrefix(name, "sha256-") {
}
if strings.HasPrefix(name, "sha256:") {
deleteMap[name] = struct{}{} deleteMap[name] = struct{}{}
} }
} }

View File

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"runtime"
"strings" "strings"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
@ -47,10 +46,7 @@ func NewLayer(r io.Reader, mediatype string) (*Layer, error) {
return nil, err return nil, err
} }
delimiter := ":" const delimiter = "-"
if runtime.GOOS == "windows" {
delimiter = "-"
}
pattern := strings.Join([]string{"sha256", "*-partial"}, delimiter) pattern := strings.Join([]string{"sha256", "*-partial"}, delimiter)
temp, err := os.CreateTemp(blobs, pattern) temp, err := os.CreateTemp(blobs, pattern)

View File

@ -6,7 +6,6 @@ import (
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
) )
@ -150,10 +149,7 @@ func GetBlobsPath(digest string) (string, error) {
return "", err return "", err
} }
if runtime.GOOS == "windows" { digest = strings.ReplaceAll(digest, ":", "-")
digest = strings.ReplaceAll(digest, ":", "-")
}
path := filepath.Join(dir, "blobs", digest) path := filepath.Join(dir, "blobs", digest)
dirPath := filepath.Dir(path) dirPath := filepath.Dir(path)
if digest == "" { if digest == "" {