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 <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-26 17:34:04 +01:00
parent 644061f465
commit 84b71af54c

View File

@@ -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
}