From 3d251072e64c9dbc9f9717225677235305ad3ee9 Mon Sep 17 00:00:00 2001 From: Tempris Admin Date: Thu, 18 Jun 2026 03:49:36 +0700 Subject: [PATCH 1/2] fix: guard against empty Build.Image in ImageNameWithDigest ImageNameWithDigest did not validate that Build.Image is non-empty. When called with a non-empty digest but empty image name, it produced the malformed OCI reference @sha256:... (missing image name prefix), causing confusing downstream parse errors in name.ParseReference. Added early return for empty image. Fixes #3902 --- pkg/functions/function.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/functions/function.go b/pkg/functions/function.go index 86c96321ba..cc17a6f273 100644 --- a/pkg/functions/function.go +++ b/pkg/functions/function.go @@ -862,6 +862,9 @@ func (f Function) ImageNameWithDigest(newDigest string) string { return f.Build.Image } image := f.Build.Image + if image == "" { + return "" + } // overwrite current digest shaIndex := strings.Index(image, "@sha256:") From 8fd22babe242c743ea80890f12e230858ba9cfab Mon Sep 17 00:00:00 2001 From: Tempris Admin Date: Fri, 26 Jun 2026 16:03:05 +0700 Subject: [PATCH 2/2] test image digest with empty image --- pkg/functions/function_unit_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/functions/function_unit_test.go b/pkg/functions/function_unit_test.go index 60335c3a99..1f5412d347 100644 --- a/pkg/functions/function_unit_test.go +++ b/pkg/functions/function_unit_test.go @@ -115,6 +115,11 @@ func TestFunction_ImageWithDigest(t *testing.T) { fields: fields{Image: "image-registry.openshift-image-registry.svc.cluster.local:50000/default/bar@sha256:42", ImageDigest: ""}, want: "image-registry.openshift-image-registry.svc.cluster.local:50000/default/bar@sha256:42", }, + { + name: "Empty image with digest", + fields: fields{Image: "", ImageDigest: "sha256:42"}, + want: "", + }, } //TODO: gauron99 - this is gonna need to be changed (probably) because: // 1: imageDigest now doesn't have a dedicated structure member (resolved?)