From 290c7639017558d13e884183c4fcc1489864cfa7 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Tue, 17 Jun 2025 22:18:51 +0800 Subject: [PATCH] feat(file_decoder): add debug logging for MIME type detection when handling application/octet-stream --- service/file_decoder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/file_decoder.go b/service/file_decoder.go index 7917fdaa..aa1bbdae 100644 --- a/service/file_decoder.go +++ b/service/file_decoder.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "fmt" "io" + "one-api/common" "one-api/constant" "one-api/dto" "strings" @@ -33,6 +34,9 @@ func GetFileBase64FromUrl(url string) (*dto.LocalFileData, error) { mimeType := resp.Header.Get("Content-Type") if mimeType == "application/octet-stream" { + if common.DebugEnabled { + println("MIME type is application/octet-stream, trying to guess from URL or filename") + } // try to guess the MIME type from the url last segment urlParts := strings.Split(url, "/") if len(urlParts) > 0 {