From 84b71af54cd1359232ac86931fc7f357c0354368 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Thu, 26 Mar 2026 17:34:04 +0100 Subject: [PATCH] Use file model MIME type instead of S3 content type GetFileBase64 read the MIME type from the S3 response header, which can be application/octet-stream for files uploaded without an explicit content type. Use file.GetMimeType() from the database instead, which stores the correct MIME type captured at upload time. This fixes evidence description failures when calling the OpenAI API with PDF files. Signed-off-by: Bryan Frimin --- pkg/filemanager/service.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/filemanager/service.go b/pkg/filemanager/service.go index 4502eb255..f51fcdb96 100644 --- a/pkg/filemanager/service.go +++ b/pkg/filemanager/service.go @@ -65,12 +65,8 @@ func (s *Service) GetFileBase64( return "", "", fmt.Errorf("cannot read file data: %w", err) } - if result.ContentType == nil || *result.ContentType == "" { - return "", "", fmt.Errorf("no MIME type available for file %s", file.GetObjectKey()) - } - base64Data = base64.StdEncoding.EncodeToString(fileData) - mimeType = *result.ContentType + mimeType = file.GetMimeType() return base64Data, mimeType, nil }