fix: Correct MIME type for JPG images for Gemini 2.0 Pro

This commit is contained in:
George·Dong 2025-03-09 17:33:10 +08:00 committed by 亢奋猫
parent a4c0224ab5
commit bdf85c68d1

View File

@ -254,7 +254,8 @@ class FileStorage {
const filePath = path.join(this.storageDir, id) const filePath = path.join(this.storageDir, id)
const data = await fs.promises.readFile(filePath) const data = await fs.promises.readFile(filePath)
const base64 = data.toString('base64') const base64 = data.toString('base64')
const mime = `image/${path.extname(filePath).slice(1)}` const ext = path.extname(filePath).slice(1) == 'jpg' ? 'jpeg' : path.extname(filePath).slice(1)
const mime = `image/${ext}`
return { return {
mime, mime,
base64, base64,