-
Notifications
You must be signed in to change notification settings - Fork 102
Description
As per the Image Spec, Platform field is optional.
However the below code will cause a panic at https://github.com/oras-project/oras-go/blob/main/internal/platform/platform.go#L40 if there is no platform in the manifest list.
for _, m := range manifests {
if Match(m.Platform, p) {
return m, nil
}
}
panic({0x1a09720, 0x2ccc1f0}) │
/usr/local/go/src/runtime/panic.go:884 +0x213 │
oras.land/oras-go/v2/internal/platform.Match(0x0, 0xc000eecd20) │
/home/dev/ws/build/.cache/go-mod/pkg/mod/oras.land/oras-go/v2@v2.3.1/internal/platform/platform.go:41 +0x39 │
oras.land/oras-go/v2/internal/platform.SelectManifest({_, }, {, }, {{0xc0006272f0, 0x27}, {0xc0007b0f50, 0x47}, 0xf68, {0x0, ...}, ...}, ...) │
/home/dev/ws/build/.cache/go-mod/pkg/mod/oras.land/oras-go/v2@v2.3.1/internal/platform/platform.go:88 +0x68b │
oras.land/oras-go/v2.(*CopyOptions).WithTargetPlatform.func1({, }, {, }, {{0xc0006272f0, 0x27}, {0xc0007b0f50, 0x47}, 0xf68, {0x0, ...}, ...}) │
/home/dev/ws/build/.cache/go-mod/pkg/mod/oras.land/oras-go/v2@v2.3.1/copy.go:78 +0x23e │
oras.land/oras-go/v2.Copy({0x1f2ca58, 0xc00005c058}, {0x1f2b750, 0xc0009980b0}, {0xc0003c7990, 0x6}, {, _}, {0x0, 0x0}, ...) │
/home/dev/ws/build/.cache/go-mod/pkg/mod/oras.land/oras-go/v2@v2.3.1/copy.go:143 +0x430