diff --git a/libimage/pull.go b/libimage/pull.go index 84ce107ee..e9ba5293c 100644 --- a/libimage/pull.go +++ b/libimage/pull.go @@ -243,14 +243,8 @@ func (r *Runtime) copyFromDefault(ctx context.Context, ref types.ImageReference, imageName = named.String() default: - // Path-based transports (e.g., dir) may include invalid - // characters, so we should pessimistically generate an ID - // instead of looking at the StringWithinTransport(). - storageName, err = getImageID(ctx, ref, nil) - if err != nil { - return nil, err - } - imageName = "sha256:" + storageName[1:] + storageName = toLocalImageName(ref.StringWithinTransport()) + imageName = storageName } // Create a storage reference. diff --git a/libimage/pull_test.go b/libimage/pull_test.go index 6bd6137b2..1aebd35f4 100644 --- a/libimage/pull_test.go +++ b/libimage/pull_test.go @@ -51,9 +51,6 @@ func TestPull(t *testing.T) { {"docker://docker.io/library/alpine", false, 1, []string{"docker.io/library/alpine:latest"}}, {"quay.io/libpod/alpine@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00", false, 1, []string{"quay.io/libpod/alpine@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00"}}, {"quay.io/libpod/alpine:pleaseignorethistag@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00", false, 1, []string{"quay.io/libpod/alpine@sha256:634a8f35b5f16dcf4aaa0822adc0b1964bb786fca12f6831de8ddc45e5986a00"}}, - - // DIR - {"dir:testdata/scratch-dir-5pec!@L", false, 1, []string{"61e17f84d763cc086d43c67dcf4cdbd69f9224c74e961c53b589b70499eac443"}}, } { pulledImages, err := runtime.Pull(ctx, test.input, config.PullPolicyAlways, pullOptions) if test.expectError { diff --git a/libimage/testdata/scratch-dir-5pec!@L/5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef b/libimage/testdata/scratch-dir-5pec!@L/5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef deleted file mode 100644 index 06d740502..000000000 Binary files a/libimage/testdata/scratch-dir-5pec!@L/5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef and /dev/null differ diff --git a/libimage/testdata/scratch-dir-5pec!@L/61e17f84d763cc086d43c67dcf4cdbd69f9224c74e961c53b589b70499eac443 b/libimage/testdata/scratch-dir-5pec!@L/61e17f84d763cc086d43c67dcf4cdbd69f9224c74e961c53b589b70499eac443 deleted file mode 100644 index 0f29a3146..000000000 --- a/libimage/testdata/scratch-dir-5pec!@L/61e17f84d763cc086d43c67dcf4cdbd69f9224c74e961c53b589b70499eac443 +++ /dev/null @@ -1 +0,0 @@ -{"created":"2021-12-20T13:03:01.601633431Z","architecture":"amd64","os":"linux","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Labels":{"io.buildah.version":"1.23.1"}},"rootfs":{"type":"layers","diff_ids":["sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"]},"history":[{"created":"2021-12-20T13:03:01.602339865Z","created_by":"/bin/sh"}]} \ No newline at end of file diff --git a/libimage/testdata/scratch-dir-5pec!@L/manifest.json b/libimage/testdata/scratch-dir-5pec!@L/manifest.json deleted file mode 100644 index 00e9e0d37..000000000 --- a/libimage/testdata/scratch-dir-5pec!@L/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"schemaVersion":2,"config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:61e17f84d763cc086d43c67dcf4cdbd69f9224c74e961c53b589b70499eac443","size":402},"layers":[{"mediaType":"application/vnd.oci.image.layer.v1.tar","digest":"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef","size":1024}],"annotations":{"org.opencontainers.image.base.digest":"","org.opencontainers.image.base.name":""}} \ No newline at end of file diff --git a/libimage/testdata/scratch-dir-5pec!@L/version b/libimage/testdata/scratch-dir-5pec!@L/version deleted file mode 100644 index 75a4f5701..000000000 --- a/libimage/testdata/scratch-dir-5pec!@L/version +++ /dev/null @@ -1 +0,0 @@ -Directory Transport Version: 1.1