Use NewStoreReference instead of ParseStoreReference

By construction, imageID is a full image ID, so avoid heuristics
by using a more specific API.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2023-11-20 18:26:38 +01:00
parent e9587f5e37
commit ff80e40adf

View File

@ -71,12 +71,11 @@ func (metadata *RuntimeContainerMetadata) SetMountLabel(mountLabel string) {
func (r *storageService) CreateContainerStorage(ctx context.Context, systemContext *types.SystemContext, imageName, imageID, containerName, containerID string, options storage.ContainerOptions) (_ ContainerInfo, retErr error) {
var imageConfig *v1.Image
if imageName != "" {
var ref types.ImageReference
if containerName == "" {
return ContainerInfo{}, define.ErrEmptyID
}
// Check if we have the specified image.
ref, err := istorage.Transport.ParseStoreReference(r.store, imageID)
ref, err := istorage.Transport.NewStoreReference(r.store, nil, imageID)
if err != nil {
return ContainerInfo{}, err
}