From 668c41b98886ceb1980a2ead97e7e2ba0f5f0485 Mon Sep 17 00:00:00 2001 From: Anthony Accioly <1591739+aaccioly@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:56:56 +0100 Subject: [PATCH] fix(blossom): handle nil BlobDescriptor in Get and Delete Refine extension derivation logic by ensuring `bd` is not nil before accessing its type. --- blossom/handlers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blossom/handlers.go b/blossom/handlers.go index 66e56fc..add1c17 100644 --- a/blossom/handlers.go +++ b/blossom/handlers.go @@ -189,11 +189,11 @@ func (bs BlossomServer) handleGetBlob(w http.ResponseWriter, r *http.Request) { var ext string bd, err := bs.Store.Get(r.Context(), hhash) if err != nil { - // can't find the blob, try to get the extension from the URL + // can't find the BlobDescriptor, try to get the extension from the URL if len(spl) == 2 { ext = spl[1] } - } else { + } else if bd != nil { ext = getExtension(bd.Type) } @@ -348,11 +348,11 @@ func (bs BlossomServer) handleDelete(w http.ResponseWriter, r *http.Request) { var ext string bd, err := bs.Store.Get(r.Context(), hhash) if err != nil { - // can't find the blob, try to get the extension from the URL + // can't find the BlobDescriptor, try to get the extension from the URL if len(spl) == 2 { ext = spl[1] } - } else { + } else if bd != nil { ext = getExtension(bd.Type) }