This commit is contained in:
ylwango613 2026-01-06 08:25:49 +01:00 committed by GitHub
commit 5360d92687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -618,6 +618,11 @@ func ggufLayers(digest string, fn func(resp api.ProgressResponse)) ([]*layerGGML
var layers []*layerGGML
fn(api.ProgressResponse{Status: "parsing GGUF"})
// verify digest not empty
if digest == "" {
return nil, fmt.Errorf("invalid digest: empty")
}
blobPath, err := GetBlobsPath(digest)
if err != nil {
return nil, err
@ -625,6 +630,10 @@ func ggufLayers(digest string, fn func(resp api.ProgressResponse)) ([]*layerGGML
blob, err := os.Open(blobPath)
if err != nil {
// remove path in err
if pathErr, ok := err.(*os.PathError); ok {
return nil, fmt.Errorf("%s: %w", pathErr.Op, pathErr.Err)
}
return nil, err
}
defer blob.Close()