mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
fix: use OCI title annotation for virtual path in GGUF layer extraction
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
parent
80319572cf
commit
ec978f01c5
5
go.mod
5
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
|
||||
|
||||
1
go.sum
1
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=
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user