Przeglądaj źródła

feat(file_decoder): add debug logging for MIME type detection when handling application/octet-stream

CaIon 8 miesięcy temu
rodzic
commit
290c763901
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      service/file_decoder.go

+ 4 - 0
service/file_decoder.go

@@ -4,6 +4,7 @@ import (
 	"encoding/base64"
 	"encoding/base64"
 	"fmt"
 	"fmt"
 	"io"
 	"io"
+	"one-api/common"
 	"one-api/constant"
 	"one-api/constant"
 	"one-api/dto"
 	"one-api/dto"
 	"strings"
 	"strings"
@@ -33,6 +34,9 @@ func GetFileBase64FromUrl(url string) (*dto.LocalFileData, error) {
 
 
 	mimeType := resp.Header.Get("Content-Type")
 	mimeType := resp.Header.Get("Content-Type")
 	if mimeType == "application/octet-stream" {
 	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
 		// try to guess the MIME type from the url last segment
 		urlParts := strings.Split(url, "/")
 		urlParts := strings.Split(url, "/")
 		if len(urlParts) > 0 {
 		if len(urlParts) > 0 {