diff --git a/go.mod b/go.mod index 8dcbac1d2..3eb181ee9 100644 --- a/go.mod +++ b/go.mod @@ -286,7 +286,10 @@ require ( modernc.org/memory v1.11.0 // indirect ) -require github.com/gpustack/gguf-parser-go v0.22.1 +require ( + github.com/cespare/xxhash/v2 v2.3.0 + github.com/gpustack/gguf-parser-go v0.22.1 +) require ( cyphar.com/go-pathrs v0.2.1 // indirect diff --git a/go.sum b/go.sum index bb8d3f3a0..550b43819 100644 --- a/go.sum +++ b/go.sum @@ -229,7 +229,6 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/syft/source/ocimodelsource/resolver.go b/syft/source/ocimodelsource/resolver.go index 8bff55ba4..4762059dc 100644 --- a/syft/source/ocimodelsource/resolver.go +++ b/syft/source/ocimodelsource/resolver.go @@ -178,6 +178,15 @@ func (r *ociModelResolver) cleanup() error { // extractVirtualPath generates a virtual path for a GGUF layer. // This simulates where the file would be in the artifact. func extractVirtualPath(layerIndex int, annotations map[string]string) string { + // Check if there's a title annotation that specifies the filename + if title, ok := annotations["org.opencontainers.image.title"]; ok && title != "" { + // Ensure it starts with / + if !strings.HasPrefix(title, "/") { + return "/" + title + } + return title + } + // Fall back to default naming return fmt.Sprintf("/model-layer-%d.gguf", layerIndex) }